Skip to content

Commit bae3fa8

Browse files
ashishkumar468misaochan
authored andcommitted
Handled sqlitexception for adding existig column in app versions which already have COLUMN location_pic
1 parent 53d3c37 commit bae3fa8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/fr/free/nrw/commons/bookmarks/locations/BookmarkLocationsDao.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.ContentValues;
55
import android.database.Cursor;
66
import android.database.sqlite.SQLiteDatabase;
7+
import android.database.sqlite.SQLiteException;
78
import android.os.RemoteException;
89
import androidx.annotation.NonNull;
910
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
@@ -264,7 +265,13 @@ public static void onUpdate(SQLiteDatabase db, int from, int to) {
264265
}
265266
if (from == 10 && to == 11) {
266267
from++;
267-
db.execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_pic STRING;");
268+
//This is safe, and can be called clean, as we/I do not remember the appropriate version for this
269+
//We are anyways switching to room, these things won't be nescessary then
270+
try {
271+
db.execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_pic STRING;");
272+
}catch (SQLiteException exception){
273+
Timber.e(exception);//
274+
}
268275
return;
269276
}
270277
}

0 commit comments

Comments
 (0)