From c092551bda8cc212bc0a921e9798be964c5fc5b0 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 2 Mar 2021 00:13:49 +0200 Subject: [PATCH] Small fix --- .../plus/settings/backend/ApplicationMode.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java b/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java index 319cab0eca..f707f82f88 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java @@ -1,5 +1,9 @@ package net.osmand.plus.settings.backend; +import androidx.annotation.ColorInt; +import androidx.annotation.DrawableRes; +import androidx.core.content.ContextCompat; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.annotations.Expose; @@ -26,10 +30,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import androidx.annotation.ColorInt; -import androidx.annotation.DrawableRes; -import androidx.core.content.ContextCompat; - import static net.osmand.plus.views.mapwidgets.MapWidgetRegistry.WIDGET_ALTITUDE; import static net.osmand.plus.views.mapwidgets.MapWidgetRegistry.WIDGET_BATTERY; import static net.osmand.plus.views.mapwidgets.MapWidgetRegistry.WIDGET_BEARING; @@ -505,8 +505,12 @@ public class ApplicationMode { } public Integer getCustomIconColor() { - String customColor = app.getSettings().CUSTOM_ICON_COLOR.getModeValue(this); - return customColor == null ? null : Algorithms.parseColor(customColor); + try { + String customColor = app.getSettings().CUSTOM_ICON_COLOR.getModeValue(this); + return Algorithms.isEmpty(customColor) ? null : Algorithms.parseColor(customColor); + } catch (IllegalArgumentException e) { + return null; + } } public void setCustomIconColor(Integer customIconColor) {