fix NPE
This commit is contained in:
parent
7bf17a1f5c
commit
640a7d3b87
1 changed files with 19 additions and 11 deletions
|
@ -41,6 +41,7 @@ import info.nightscout.androidaps.events.EventReloadTempBasalData;
|
||||||
import info.nightscout.androidaps.events.EventReloadTreatmentData;
|
import info.nightscout.androidaps.events.EventReloadTreatmentData;
|
||||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.logging.L;
|
import info.nightscout.androidaps.logging.L;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
||||||
|
@ -1571,7 +1572,9 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
if (trJson.has("profileJson"))
|
if (trJson.has("profileJson"))
|
||||||
profileSwitch.profileJson = trJson.getString("profileJson");
|
profileSwitch.profileJson = trJson.getString("profileJson");
|
||||||
else {
|
else {
|
||||||
ProfileStore store = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile();
|
ProfileInterface profileInterface = MainApp.getConfigBuilder().getActiveProfileInterface();
|
||||||
|
if (profileInterface != null) {
|
||||||
|
ProfileStore store = profileInterface.getProfile();
|
||||||
if (store != null) {
|
if (store != null) {
|
||||||
Profile profile = store.getSpecificProfile(profileSwitch.profileName);
|
Profile profile = store.getSpecificProfile(profileSwitch.profileName);
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
|
@ -1590,6 +1593,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
log.debug("Store for profile switch doesn't exist. Ignoring: " + trJson.toString());
|
log.debug("Store for profile switch doesn't exist. Ignoring: " + trJson.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (L.isEnabled(L.DATABASE))
|
||||||
|
log.debug("No active profile interface. Ignoring: " + trJson.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (trJson.has("profilePlugin"))
|
if (trJson.has("profilePlugin"))
|
||||||
profileSwitch.profilePlugin = trJson.getString("profilePlugin");
|
profileSwitch.profilePlugin = trJson.getString("profilePlugin");
|
||||||
|
|
Loading…
Reference in a new issue