From b49f51d6ead5dba880b8d4abeecd9f7740b8ba1a Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 15 Sep 2017 10:53:16 +0300 Subject: [PATCH] Add null check; clear onUpgrade --- OsmAnd/src/net/osmand/plus/MapMarkersHelper.java | 3 +++ OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 82720e9ef2..501f009d7e 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -302,6 +302,9 @@ public class MapMarkersHelper { if (group.getType() == MarkersSyncGroup.FAVORITES_TYPE) { FavouritesDbHelper.FavoriteGroup favGroup = ctx.getFavorites().getGroup(group.name); + if (favGroup == null) { + return; + } if (!favGroup.visible) { removeActiveMarkersFromSyncGroup(group.id); return; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java index 939e1732c3..ba49cfd77d 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -117,9 +117,7 @@ public class MapMarkersDbHelper { } private void onUpgrade(SQLiteConnection db, int oldVersion, int newVersion) { - db.execSQL("DROP TABLE IF EXISTS " + MARKERS_TABLE_NAME); - db.execSQL("DROP TABLE IF EXISTS " + GROUPS_TABLE_NAME); - onCreate(db); + } private void saveExistingMarkersToDb() {