mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibGUI: Guard us from trying to slice an empty Arguments::strings
This fixes an issue when we sometime pass in an empty Main::Arguments to GUI::Application::create(). Also, this mimics the behavior that Application::construct() had which only iterated over argv when more than one argument was passed to it.
This commit is contained in:
parent
1b8788157c
commit
8eaf28b4ce
1 changed files with 4 additions and 2 deletions
|
@ -93,8 +93,10 @@ ErrorOr<NonnullRefPtr<Application>> Application::create(Main::Arguments const& a
|
|||
if (getenv("GUI_DND_DEBUG"))
|
||||
application->m_dnd_debugging_enabled = true;
|
||||
|
||||
for (auto arg : arguments.strings.slice(1))
|
||||
TRY(application->m_args.try_append(arg));
|
||||
if (!arguments.strings.is_empty()) {
|
||||
for (auto arg : arguments.strings.slice(1))
|
||||
TRY(application->m_args.try_append(arg));
|
||||
}
|
||||
|
||||
application->m_tooltip_show_timer = TRY(Core::Timer::create_single_shot(700, [weak_application = application->make_weak_ptr<Application>()] {
|
||||
weak_application->request_tooltip_show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue