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,14 +1470,19 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
profileSwitch.profileJson = trJson.getString("profileJson"); profileSwitch.profileJson = trJson.getString("profileJson");
else { else {
ProfileStore store = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile(); ProfileStore store = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile();
Profile profile = store.getSpecificProfile(profileSwitch.profileName); if (store != null) {
if (profile != null) { Profile profile = store.getSpecificProfile(profileSwitch.profileName);
profileSwitch.profileJson = profile.getData().toString(); if (profile != null) {
log.debug("Profile switch prefilled with JSON from local store"); profileSwitch.profileJson = profile.getData().toString();
// Update data in NS log.debug("Profile switch prefilled with JSON from local store");
NSUpload.updateProfileSwitch(profileSwitch); // Update data in NS
NSUpload.updateProfileSwitch(profileSwitch);
} else {
log.debug("JSON for profile switch doesn't exist. Ignoring: " + trJson.toString());
return;
}
} else { } else {
log.debug("JSON for profile switch doesn't exist. Ignoring: " + trJson.toString()); log.debug("Store for profile switch doesn't exist. Ignoring: " + trJson.toString());
return; return;
} }
} }