JAL-2759 hiddenColumns null check
authorkiramt <k.mourao@dundee.ac.uk>
Fri, 13 Oct 2017 08:53:34 +0000 (09:53 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Fri, 13 Oct 2017 08:53:34 +0000 (09:53 +0100)
src/jalview/datamodel/HiddenColumns.java

index 1ac6015..3710829 100644 (file)
@@ -921,17 +921,20 @@ public class HiddenColumns
     try
     {
       LOCK.writeLock().lock();
-      Iterator<int[]> it = hiddenColumns.iterator();
-      while (it.hasNext())
+      if (hiddenColumns != null)
       {
-        int[] region = it.next();
-        for (int j = region[0]; j < region[1] + 1; j++)
+        Iterator<int[]> it = hiddenColumns.iterator();
+        while (it.hasNext())
         {
-          sel.addElement(j);
+          int[] region = it.next();
+          for (int j = region[0]; j < region[1] + 1; j++)
+          {
+            sel.addElement(j);
+          }
         }
+        hiddenColumns = null;
+        cursor.resetCursor(hiddenColumns);
       }
-      hiddenColumns = null;
-      cursor.resetCursor(hiddenColumns);
     } finally
     {
       LOCK.writeLock().unlock();