From 52197ae301150e4b8be1e4f35d36d0f5086f1037 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 8 Apr 2018 18:14:27 +0200 Subject: [PATCH] Fixed nullpointer issue when there is no icon file specified --- src/dorkbox/systemTray/ui/swing/TrayPopup.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dorkbox/systemTray/ui/swing/TrayPopup.java b/src/dorkbox/systemTray/ui/swing/TrayPopup.java index 6ccb783..16ddc61 100644 --- a/src/dorkbox/systemTray/ui/swing/TrayPopup.java +++ b/src/dorkbox/systemTray/ui/swing/TrayPopup.java @@ -116,11 +116,13 @@ class TrayPopup extends JPopupMenu { this.iconFile = imageFile; try { - Image image = new ImageIcon(ImageIO.read(imageFile)).getImage(); - image.flush(); + if (imageFile != null) { + Image image = new ImageIcon(ImageIO.read(imageFile)).getImage(); + image.flush(); - // we set the dialog window to have the same icon as what is on the system tray - hiddenDialog.setIconImage(image); + // we set the dialog window to have the same icon as what is on the system tray + hiddenDialog.setIconImage(image); + } } catch (IOException e) { SystemTray.logger.error("Error setting the title-bar image for the popup menu task tray dialog"); }