JAL-2674 Added missing null check feature/JAL-2674take2
authorkiramt <k.mourao@dundee.ac.uk>
Wed, 8 Nov 2017 07:59:44 +0000 (07:59 +0000)
committerkiramt <k.mourao@dundee.ac.uk>
Wed, 8 Nov 2017 07:59:44 +0000 (07:59 +0000)
src/jalview/datamodel/HiddenColumns.java

index 399e083..da91f7b 100644 (file)
@@ -907,16 +907,19 @@ 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;
       }
-      hiddenColumns = null;
     } finally
     {
       LOCK.writeLock().unlock();