check for NPE

This commit is contained in:
Milos Kozak 2018-06-20 23:56:38 +02:00
parent af8e1fb32f
commit a02961da61

View file

@ -1470,6 +1470,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
profileSwitch.profileJson = trJson.getString("profileJson");
else {
ProfileStore store = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile();
if (store != null) {
Profile profile = store.getSpecificProfile(profileSwitch.profileName);
if (profile != null) {
profileSwitch.profileJson = profile.getData().toString();
@ -1480,6 +1481,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
log.debug("JSON for profile switch doesn't exist. Ignoring: " + trJson.toString());
return;
}
} else {
log.debug("Store for profile switch doesn't exist. Ignoring: " + trJson.toString());
return;
}
}
if (trJson.has("profilePlugin"))
profileSwitch.profilePlugin = trJson.getString("profilePlugin");