From 67eb6b20ed984df85615c7377b3f7116d575bbd0 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 13 Dec 2017 13:54:23 +0100 Subject: [PATCH] Handle errors when reading the history for verification fails. --- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 7 +++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 3afe16786b..01daaddb58 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -511,6 +511,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf log.debug("Trying to determine from pump history what was actually delivered"); CommandResult readLastBolusResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_verifying_delivered_bolus), 3, () -> ruffyScripter.readHistory(new PumpHistoryRequest().bolusHistory(PumpHistoryRequest.LAST))); + if (!readLastBolusResult.success || readLastBolusResult.history == null) { + // this happens when the cartridge runs empty during delivery, the pump will be in an error + // state with multiple alarms ringing and no chance of reading history + return new PumpEnactResult().success(false).enacted(false) + .comment(MainApp.sResources.getString(R.string.combo_error_bolus_verification_failed)); + } + List bolusHistory = readLastBolusResult.history.bolusHistory; Bolus lastBolus = !bolusHistory.isEmpty() ? bolusHistory.get(0) : null; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 74702bdfd4..e86aa7872d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -840,5 +840,6 @@ Bolus delivery failed. It appears no bolus was delivered. To be sure, please check the pump to avoid a double bolus and then bolus again. To guard against bugs, boluses are not automatically retried. Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions. Verifying delivered bolus + Delivering the bolus and verifying the pump\'s history failed, please check the pump and manually create a bolus record using the Careportal tab if a bolus was delivered.