JAL-4446 avoid NPE when progress bar message is null
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 6 Aug 2024 11:06:49 +0000 (12:06 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Tue, 6 Aug 2024 11:06:49 +0000 (12:06 +0100)
src/jalview/gui/Desktop.java
src/jalview/gui/ProgressBar.java

index 394ef65..c1ad996 100644 (file)
@@ -2939,7 +2939,11 @@ public class Desktop extends jalview.jbgui.GDesktop
     else
     {
       progressBars.put(Long.valueOf(id), addProgressPanel(message));
-      progressBarMessages.put(id, message);
+      if (message!=null) {
+        progressBarMessages.put(id, message);
+      } else {
+        progressBarMessages.remove(id);
+      }
     }
   }
 
index e6ee641..37a4b94 100644 (file)
@@ -157,13 +157,13 @@ public class ProgressBar implements IProgressIndicator
           JProgressBar progressBar = new JProgressBar();
           progressBar.setIndeterminate(true);
           
-          progressPanel.add(new JLabel(message), BorderLayout.WEST);
+          progressPanel.add(new JLabel(message==null ? "" : message), BorderLayout.WEST);
           progressPanel.add(progressBar, BorderLayout.CENTER);
 
           addRow(progressPanel);
 
           progressBars.put(id, progressPanel);
-          progressBarMessages.put(id, message);
+          progressBarMessages.put(id, message == null ? "" : message);
         }
 
         refreshLayout();