JAL-4242 null check on getValue() return bug/JAL-4242_exception_when_pressing_escape_in_fetch_from_URL_dialog
authorBen Soares <b.soares@dundee.ac.uk>
Fri, 18 Aug 2023 09:03:13 +0000 (10:03 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Fri, 18 Aug 2023 09:03:13 +0000 (10:03 +0100)
src/jalview/gui/JvOptionPane.java

index c0efd4a..e622445 100644 (file)
@@ -1129,7 +1129,13 @@ public class JvOptionPane extends JOptionPane
 
   private void internalDialogHandleResponse()
   {
-    String responseString = (String) this.getValue();
+    Object value = this.getValue();
+    if (value == null
+            || (value instanceof Integer && (Integer) value == -1))
+    {
+      return;
+    }
+    String responseString = value.toString();
     int response = ourOptions.indexOf(responseString);
 
     if (!Platform.isJS())