From 93809f5b914e8bd644421b50501293a92cac5225 Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Mon, 22 Apr 2019 04:32:18 +0200 Subject: [PATCH] Avoid NPE in ColorPickerPreference.java. --- .../preference/colorpicker/ColorPickerPreference.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java index 4fb80d8..ff06263 100644 --- a/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java +++ b/DroidFishApp/src/main/java/net/margaritov/preference/colorpicker/ColorPickerPreference.java @@ -181,9 +181,10 @@ public class ColorPickerPreference mValue = color; setPreviewColor(); try { - getOnPreferenceChangeListener().onPreferenceChange(this, color); - } catch (NullPointerException e) { - + Preference.OnPreferenceChangeListener listener = getOnPreferenceChangeListener(); + if (listener != null) + listener.onPreferenceChange(this, color); + } catch (NullPointerException ignore) { } }