mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
Userland/Notify: Check if optional icon arg is null before loading
The commandline "notify" application was always attempting to load an icon path from an optional argument, even when the argument was omitted. In this case, the image icon argument would be a null pointer and the notify program would crash. This fix adds a conditional to only attempt to load the icon file if the icon_path variable is not a null pointer
This commit is contained in:
parent
060e5ccbbc
commit
99b263a2db
1 changed files with 2 additions and 1 deletions
|
@ -25,7 +25,8 @@ int main(int argc, char** argv)
|
|||
auto notification = GUI::Notification::construct();
|
||||
notification->set_text(message);
|
||||
notification->set_title(title);
|
||||
notification->set_icon(Gfx::Bitmap::try_load_from_file(icon_path).release_value_but_fixme_should_propagate_errors());
|
||||
if (icon_path)
|
||||
notification->set_icon(Gfx::Bitmap::try_load_from_file(icon_path).release_value_but_fixme_should_propagate_errors());
|
||||
notification->show();
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue