Merge branch 'develop' into bug/JAL-1803_JAL-2157
[jalview.git] / src / jalview / ext / jmol / JmolParser.java
index 2cb7559..7836d24 100644 (file)
@@ -270,6 +270,10 @@ public class JmolParser extends StructureFile implements JmolStatusListener
       // diff < 5 then mark as valid and update termination Atom
       if (chainTerMap.containsKey(curAtomChId))
       {
+        if (curAtom.getResno() < chainTerMap.get(curAtomChId).getResno())
+        {
+          return false;
+        }
         if ((curAtom.getResno() - chainTerMap.get(curAtomChId).getResno()) < 5)
         {
           chainTerMap.put(curAtomChId, curAtom);
@@ -281,6 +285,10 @@ public class JmolParser extends StructureFile implements JmolStatusListener
     // atom with previously terminated chain encountered
     else if (chainTerMap.containsKey(curAtomChId))
     {
+      if (curAtom.getResno() < chainTerMap.get(curAtomChId).getResno())
+      {
+        return false;
+      }
       if ((curAtom.getResno() - chainTerMap.get(curAtomChId).getResno()) < 5)
       {
         chainTerMap.put(curAtomChId, curAtom);