JAL-1270 more fix for failing Functional test
[jalview.git] / src / MCview / PDBChain.java
index 91526e1..3b84ee3 100755 (executable)
@@ -148,6 +148,10 @@ public class PDBChain
 
       if (as.astr1.charAt(i) == as.astr2.charAt(i))
       {
+        if (pdbpos >= residues.size())
+        {
+          continue;
+        }
         Residue res = residues.elementAt(pdbpos);
         for (Atom atom : res.atoms)
         {
@@ -189,6 +193,10 @@ public class PDBChain
       status = PDBChain.IEASTATUS;
     }
     SequenceFeature[] features = sequence.getSequenceFeatures();
+    if (features == null)
+    {
+      return null;
+    }
     for (int i = 0; i < features.length; i++)
     {
       if (features[i].getFeatureGroup().equals(pdbid))
@@ -386,9 +394,12 @@ public class PDBChain
                 || ResidueProperties.nucleotideIndex[nucname
                         .charAt((deoxyn ? 1 : 0))] == -1)
         {
-          seq.append("X");
-          // System.err.println("PDBReader:Null aa3Hash for " +
-          // tmpat.resName);
+            char r = ResidueProperties
+                    .getSingleCharacterCode(ResidueProperties
+                            .getCanonicalAminoAcid(tmpat.resName));
+            seq.append(r == '0' ? 'X' : r);
+            // System.err.println("PDBReader:Null aa3Hash for " +
+            // tmpat.resName);
         }
         else
         {