summaryrefslogtreecommitdiff
path: root/Userland/Utilities
diff options
context:
space:
mode:
authorMax Trussell <maxtrussell@gmail.com>2021-12-19 00:34:01 -0800
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-19 00:50:53 -0800
commit99b263a2db0c2ca8486ee6bfd72118fd33f2bcca (patch)
treeb04c146d57194c06ee0921ca9cb110824b14995d /Userland/Utilities
parent060e5ccbbc30fd52ee130677fdfa9af521d10400 (diff)
downloadserenity-99b263a2db0c2ca8486ee6bfd72118fd33f2bcca.zip
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
Diffstat (limited to 'Userland/Utilities')
-rw-r--r--Userland/Utilities/notify.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Utilities/notify.cpp b/Userland/Utilities/notify.cpp
index 94df318139..151b12d694 100644
--- a/Userland/Utilities/notify.cpp
+++ b/Userland/Utilities/notify.cpp
@@ -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;