Fix NPE's

This commit is contained in:
Victor Shcherb 2018-06-10 18:18:00 +02:00
parent 765402b4e8
commit 55aec52fc0
2 changed files with 6 additions and 0 deletions

View file

@ -47,6 +47,9 @@ public class DatabaseHelper {
private SQLiteAPI.SQLiteConnection openConnection(boolean readonly) {
SQLiteAPI.SQLiteConnection conn = app.getSQLiteAPI().getOrCreateDatabase(DB_NAME, readonly);
if (conn == null) {
return null;
}
if (conn.getVersion() == 0 || DB_VERSION != conn.getVersion()) {
if (readonly) {
conn.close();

View file

@ -112,6 +112,9 @@ public class MapMarkersDbHelper {
private SQLiteConnection openConnection(boolean readonly) {
SQLiteConnection conn = context.getSQLiteAPI().getOrCreateDatabase(DB_NAME, readonly);
if (conn == null) {
return conn;
}
int version = conn.getVersion();
if (version == 0 || DB_VERSION != version) {
if (readonly) {