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) {