From 5ad6d650b6726eb880d8342d19711e626f6ae2f0 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 20 Sep 2005 13:15:31 +0000 Subject: [PATCH] Null pointer if user presses shift before anything else --- src/jalview/gui/UserDefinedColours.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 79df106..ec4ad55 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -139,8 +139,12 @@ public class UserDefinedColours extends GUserDefinedColours if(e.isShiftDown()) { - JButton start = (JButton)selectedButtons.elementAt(selectedButtons.size()-1); - JButton end = (JButton) e.getSource(); + JButton start, end = (JButton) e.getSource(); + if(selectedButtons.size()>1) + start = (JButton)selectedButtons.elementAt(selectedButtons.size()-1); + else + start = (JButton) e.getSource(); + int startIndex=0, endIndex=0; for(int b=0; b