From dd7a67a90978edc86feed9886c3f1572ea2d4fbc Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 20 Apr 2019 00:07:47 +0200 Subject: [PATCH] catch color parsing errors --- .../AbstractNotificationBuilder.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/notifications/AbstractNotificationBuilder.java b/src/org/thoughtcrime/securesms/notifications/AbstractNotificationBuilder.java index 82b15d455..d6567386a 100644 --- a/src/org/thoughtcrime/securesms/notifications/AbstractNotificationBuilder.java +++ b/src/org/thoughtcrime/securesms/notifications/AbstractNotificationBuilder.java @@ -71,7 +71,14 @@ public abstract class AbstractNotificationBuilder extends NotificationCompat.Bui if (!ledColor.equals("none")) { String[] blinkPatternArray = parseBlinkPattern(ledBlinkPattern, ledBlinkPatternCustom); - setLights(Color.parseColor(ledColor), + int argb; + try { + argb = Color.parseColor(ledColor); + } + catch (Exception e) { + argb = Color.rgb(0xFF, 0xFF, 0xFF); + } + setLights(argb, Integer.parseInt(blinkPatternArray[0]), Integer.parseInt(blinkPatternArray[1])); } @@ -154,7 +161,14 @@ public abstract class AbstractNotificationBuilder extends NotificationCompat.Bui if (!ledColor.equals("none")) { channel.enableLights(true); - channel.setLightColor(Color.parseColor(ledColor)); + int argb; + try { + argb = Color.parseColor(ledColor); + } + catch (Exception e) { + argb = Color.rgb(0xFF, 0xFF, 0xFF); + } + channel.setLightColor(argb); } else { channel.enableLights(false); }