Abort APS run if AS requested but not yet available.

Should only occur during startup or when something else is broken
already, so just return.
This commit is contained in:
Johannes Mockenhaupt 2018-07-22 17:57:17 +02:00
parent b435c09771
commit 777542dbb8
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.OpenAPSAMA;
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -173,7 +174,10 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
startPart = new Date();
if (MainApp.getConstraintChecker().isAutosensModeEnabled().value()) {
lastAutosensResult = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("OpenAPSPlugin").autosensResult;
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("OpenAPSPlugin");
if (autosensData == null) {
return;
}
} else {
lastAutosensResult = new AutosensResult();
lastAutosensResult.sensResult = "autosens disabled";

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.OpenAPSSMB;
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -180,7 +181,11 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
startPart = new Date();
if (MainApp.getConstraintChecker().isAutosensModeEnabled().value()) {
lastAutosensResult = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("OpenAPSPlugin").autosensResult;
AutosensData autosensData = IobCobCalculatorPlugin.getPlugin().getLastAutosensDataSynchronized("OpenAPSPlugin");
if (autosensData == null) {
return;
}
lastAutosensResult = autosensData.autosensResult;
} else {
lastAutosensResult = new AutosensResult();
lastAutosensResult.sensResult = "autosens disabled";