fix exception in sms comm

This commit is contained in:
Milos Kozak 2017-05-02 22:49:17 +02:00
parent 1b69771893
commit b80c382512

View file

@ -262,6 +262,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
Answers.getInstance().logCustom(new CustomEvent("SMS_Bg")); Answers.getInstance().logCustom(new CustomEvent("SMS_Bg"));
break; break;
case "LOOP": case "LOOP":
if (splited.length > 1)
switch (splited[1].toUpperCase()) { switch (splited[1].toUpperCase()) {
case "DISABLE": case "DISABLE":
case "STOP": case "STOP":
@ -333,6 +334,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
} }
break; break;
case "TREATMENTS": case "TREATMENTS":
if (splited.length > 1)
switch (splited[1].toUpperCase()) { switch (splited[1].toUpperCase()) {
case "REFRESH": case "REFRESH":
Intent restartNSClient = new Intent(Intents.ACTION_RESTART); Intent restartNSClient = new Intent(Intents.ACTION_RESTART);
@ -347,6 +349,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
} }
break; break;
case "NSCLIENT": case "NSCLIENT":
if (splited.length > 1)
switch (splited[1].toUpperCase()) { switch (splited[1].toUpperCase()) {
case "RESTART": case "RESTART":
Intent restartNSClient = new Intent(Intents.ACTION_RESTART); Intent restartNSClient = new Intent(Intents.ACTION_RESTART);
@ -450,7 +453,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
PumpInterface pumpInterface = MainApp.getConfigBuilder(); PumpInterface pumpInterface = MainApp.getConfigBuilder();
if (pumpInterface != null) { if (pumpInterface != null) {
danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class); danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
PumpEnactResult result = pumpInterface.deliverTreatment(MainApp.getConfigBuilder().getActiveInsulin() ,bolusWaitingForConfirmation.bolusRequested, 0, null); PumpEnactResult result = pumpInterface.deliverTreatment(MainApp.getConfigBuilder().getActiveInsulin(), bolusWaitingForConfirmation.bolusRequested, 0, null);
if (result.success) { if (result.success) {
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered); reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);
if (danaRPlugin != null) if (danaRPlugin != null)