From 1f03f39dd61edfae9d0c57fe43ea705729bc8043 Mon Sep 17 00:00:00 2001 From: Alessandro Falappa Date: Sun, 7 Feb 2016 15:00:12 +0100 Subject: [PATCH] Fix possible ArrayOutOfBoundsException in DarculaSpinnerUI.java. Manifests itself when using Toedter JCalendar library --- src/com/bulenkov/darcula/ui/DarculaSpinnerUI.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com/bulenkov/darcula/ui/DarculaSpinnerUI.java b/src/com/bulenkov/darcula/ui/DarculaSpinnerUI.java index 1246fa4..eed9d83 100755 --- a/src/com/bulenkov/darcula/ui/DarculaSpinnerUI.java +++ b/src/com/bulenkov/darcula/ui/DarculaSpinnerUI.java @@ -52,13 +52,13 @@ public class DarculaSpinnerUI extends BasicSpinnerUI { @Override protected void replaceEditor(JComponent oldEditor, JComponent newEditor) { - super.replaceEditor(oldEditor, newEditor); - if (oldEditor != null) { - oldEditor.getComponents()[0].removeFocusListener(myFocusListener); - } - if (newEditor != null) { - newEditor.getComponents()[0].addFocusListener(myFocusListener); - } + super.replaceEditor(oldEditor, newEditor); + if (oldEditor != null && oldEditor.getComponents().length > 0) { + oldEditor.getComponents()[0].removeFocusListener(myFocusListener); + } + if (newEditor != null && newEditor.getComponents().length > 0) { + newEditor.getComponents()[0].addFocusListener(myFocusListener); + } } @Override