From 4e52a35a75a7ce847572ea90b3ec6ffdd6844394 Mon Sep 17 00:00:00 2001 From: Daniel Heid Date: Thu, 16 Mar 2023 11:35:37 +0100 Subject: [PATCH] #26 Prevent NPE on resize if component not installed --- .../com/bric/colorpicker/colorslider/ColorSliderUI.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/bric/colorpicker/colorslider/ColorSliderUI.java b/src/main/java/com/bric/colorpicker/colorslider/ColorSliderUI.java index 5b2aa13..e2d659d 100644 --- a/src/main/java/com/bric/colorpicker/colorslider/ColorSliderUI.java +++ b/src/main/java/com/bric/colorpicker/colorslider/ColorSliderUI.java @@ -204,8 +204,10 @@ private class ResizeListener extends ComponentAdapter { @Override public void componentResized(ComponentEvent e) { - calculateGeometry(); - slider.repaint(); + if (focusRect != null) { + calculateGeometry(); + slider.repaint(); + } } }