From 5499396661996aa105a383663711de176bdab9be Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 4 Sep 2018 22:26:59 +0200 Subject: [PATCH] fix NPE --- .../java/info/nightscout/androidaps/services/DataService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/services/DataService.java b/app/src/main/java/info/nightscout/androidaps/services/DataService.java index 6edd49c0ed..cfc564770d 100644 --- a/app/src/main/java/info/nightscout/androidaps/services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/services/DataService.java @@ -208,6 +208,10 @@ public class DataService extends IntentService { double insulin = JsonHelper.safeGetDouble(json, "insulin"); double carbs = JsonHelper.safeGetDouble(json, "carbs"); String eventType = JsonHelper.safeGetString(json, "eventType"); + if (eventType == null) { + log.debug("Wrong treatment. Ignoring : " + json.toString()); + return; + } if (insulin > 0 || carbs > 0) { EventNsTreatment evtTreatment = new EventNsTreatment(mode, json); MainApp.bus().post(evtTreatment);