Null pointer if user presses shift before anything else
authoramwaterhouse <Andrew Waterhouse>
Tue, 20 Sep 2005 13:15:31 +0000 (13:15 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 20 Sep 2005 13:15:31 +0000 (13:15 +0000)
src/jalview/gui/UserDefinedColours.java

index 79df106..ec4ad55 100755 (executable)
@@ -139,8 +139,12 @@ public class UserDefinedColours extends GUserDefinedColours
 \r
       if(e.isShiftDown())\r
       {\r
-        JButton start = (JButton)selectedButtons.elementAt(selectedButtons.size()-1);\r
-        JButton end = (JButton) e.getSource();\r
+        JButton start, end = (JButton) e.getSource();\r
+        if(selectedButtons.size()>1)\r
+          start = (JButton)selectedButtons.elementAt(selectedButtons.size()-1);\r
+        else\r
+          start = (JButton) e.getSource();\r
+\r
         int startIndex=0, endIndex=0;\r
         for(int b=0; b<buttonPanel.getComponentCount(); b++)\r
         {\r