JAL-3253-applet JAL-3383
[jalview.git] / src / jalview / renderer / ResidueColourFinder.java
index 2da7233..2e45117 100644 (file)
@@ -116,12 +116,13 @@ public class ResidueColourFinder
   public SequenceGroup getCurrentSequenceGroup(SequenceGroup[] allGroups,
           int res)
   {
-    if (allGroups == null)
+    int n;
+    if (allGroups == null || (n = allGroups.length) == 0)
     {
       return null;
     }
 
-    for (int i = 0; i < allGroups.length; i++)
+    for (int i = 0; i < n; i++)
     {
       if ((allGroups[i].getStartRes() <= res)
               && (allGroups[i].getEndRes() >= res))