JAL-4440 defensive checks for Jmol/Jalview binding issue
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 8 Jul 2024 10:13:59 +0000 (11:13 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 8 Jul 2024 10:13:59 +0000 (11:13 +0100)
src/jalview/ext/jmol/JalviewJmolBinding.java

index 93a5633..1c19854 100644 (file)
@@ -785,6 +785,17 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
         }
         else
         {
+          PDBEntry ppe=getPdbEntry(pe);
+          if (ppe==null) {
+            Console.warn("Please report under JAL-4440: Unexpected null entry for PDBEntry for a structure (for structure "+fileName+")");
+            
+            continue;
+          }
+          if (ppe.getFile()==null)
+          {
+            Console.warn("Please report under JAL-4440: Unexpected null entry for file that we just tried to load into Jmol: pdbEntry: "+ppe.toString()+"(for structure "+fileName+")");
+            continue;
+          }
           File fl = new File(getPdbEntry(pe).getFile());
           matches = fl.equals(new File(fileName));
           if (matches)