better check for app initialization

This commit is contained in:
Milos Kozak 2017-06-27 10:00:22 +02:00
parent dbd721319e
commit ab63c2fb48
2 changed files with 4 additions and 0 deletions

View file

@ -1013,6 +1013,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
public Profile getProfile(long time) {
if (activeTreatments == null)
return null; //app not initialized
//log.debug("Profile for: " + new Date(time).toLocaleString() + " : " + getProfileName(time));
ProfileSwitch profileSwitch = getProfileSwitchFromHistory(time);
if (profileSwitch != null) {

View file

@ -303,6 +303,8 @@ public class IobCobCalculatorPlugin implements PluginBase {
public void calculateSensitivityData() {
if (MainApp.getConfigBuilder() == null)
return; // app still initializing
if (MainApp.getConfigBuilder().getProfile() == null)
return; // app still initializing
//log.debug("Locking calculateSensitivityData");
synchronized (dataLock) {