more checks for null

This commit is contained in:
Milos Kozak 2017-06-19 22:55:56 +02:00
parent df3dff1940
commit b185733859
5 changed files with 24 additions and 1 deletions

View file

@ -1018,7 +1018,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
if (profileSwitch != null) { if (profileSwitch != null) {
if (profileSwitch.profileJson != null) { if (profileSwitch.profileJson != null) {
return profileSwitch.getProfileObject(); return profileSwitch.getProfileObject();
} else { } else if (activeProfile.getProfile() != null){
Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName); Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName);
if (profile != null) if (profile != null)
return profile; return profile;

View file

@ -234,6 +234,12 @@ public class LoopPlugin implements PluginBase {
return; return;
} }
if (configBuilder.getProfile() == null) {
log.debug(MainApp.sResources.getString(R.string.noprofileselected));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.noprofileselected)));
return;
}
// Check if pump info is loaded // Check if pump info is loaded
if (configBuilder.getBaseBasalRate() < 0.01d) return; if (configBuilder.getBaseBasalRate() < 0.01d) return;

View file

@ -135,6 +135,13 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
PumpInterface pump = MainApp.getConfigBuilder(); PumpInterface pump = MainApp.getConfigBuilder();
if (profile == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.noprofileselected)));
if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.noprofileselected));
return;
}
if (!isEnabled(PluginBase.APS)) { if (!isEnabled(PluginBase.APS)) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled)));
if (Config.logAPSResult) if (Config.logAPSResult)

View file

@ -133,6 +133,13 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
PumpInterface pump = MainApp.getConfigBuilder(); PumpInterface pump = MainApp.getConfigBuilder();
if (profile == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.noprofileselected)));
if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.noprofileselected));
return;
}
if (!isEnabled(PluginBase.APS)) { if (!isEnabled(PluginBase.APS)) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled)));
if (Config.logAPSResult) if (Config.logAPSResult)

View file

@ -115,6 +115,9 @@ public class PersistentNotificationPlugin implements PluginBase {
String line1 = ctx.getString(R.string.noprofile); String line1 = ctx.getString(R.string.noprofile);
if (MainApp.getConfigBuilder().getActiveProfileInterface() == null)
return;
String units = MainApp.getConfigBuilder().getProfileUnits(); String units = MainApp.getConfigBuilder().getProfileUnits();