diff --git a/OsmAnd/src/net/osmand/plus/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/SettingsHelper.java index 89263d9323..498eecbadd 100644 --- a/OsmAnd/src/net/osmand/plus/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/SettingsHelper.java @@ -140,14 +140,20 @@ public class SettingsHelper { boolean shouldReplace = false; SettingsItem(@NonNull SettingsItemType type) { + init(); this.type = type; } SettingsItem(@NonNull SettingsItemType type, @NonNull JSONObject json) throws JSONException { + init(); this.type = type; readFromJson(json); } + protected void init() { + // override + } + @NonNull public SettingsItemType getType() { return type; @@ -349,10 +355,16 @@ public class SettingsHelper { public abstract static class CollectionSettingsItem extends SettingsItem { - protected List items = new ArrayList<>(); - protected List duplicateItems = new ArrayList<>(); + protected List items; + protected List duplicateItems; protected List existingItems; + @Override + protected void init() { + items = new ArrayList<>(); + duplicateItems = new ArrayList<>(); + } + CollectionSettingsItem(@NonNull SettingsItemType type, @NonNull List items) { super(type); this.items = items;