Added check for negative start columns
[jalview.git] / src / jalview / datamodel / SequenceGroup.java
index e2f15e1..20b23a9 100755 (executable)
@@ -184,7 +184,19 @@ public class SequenceGroup implements AnnotatedCollectionI
     this.displayText = displayText;
     this.colourText = colourText;
     this.cs = new ResidueShader(scheme);
-    startRes = start;
+    
+    if (start > 0) // sanity check for negative start column positions
+    {
+      startRes = start;
+    }
+    else
+    {
+      jalview.bin.Cache.log.warn(
+              "Negative start column index detected, resetting to default index: "
+                      + startRes);
+      // start = startRes;
+    }
+    
     endRes = end;
     recalcConservation();
   }
@@ -208,7 +220,20 @@ public class SequenceGroup implements AnnotatedCollectionI
       displayBoxes = seqsel.displayBoxes;
       displayText = seqsel.displayText;
       colourText = seqsel.colourText;
-      startRes = seqsel.startRes;
+      
+      if (seqsel.startRes > 0) // sanity check for negative start column
+                               // positions
+      {
+        startRes = seqsel.startRes;
+      }
+      else
+      {
+        jalview.bin.Cache.log.warn(
+                "Negative start column index detected, resetting to default index: "
+                        + startRes);
+        // seqsel.startRes = startRes;
+      }
+  
       endRes = seqsel.endRes;
       cs = new ResidueShader((ResidueShader) seqsel.cs);
       if (seqsel.description != null)