From aea47420e112f645d7e27d268030163ec75fae35 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 7 Dec 2017 10:40:00 +0100 Subject: [PATCH] fix NPE when profile not loaded --- .../plugins/Wear/wearintegration/WatchUpdaterService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index 7acdd15d72..944774baaa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -538,8 +538,10 @@ public class WatchUpdaterService extends WearableListenerService implements //bgi String bgiString = ""; Profile profile = MainApp.getConfigBuilder().getProfile(); - double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf(); - bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi); + if(profile!=null) { + double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf(); + bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi); + } String status = generateStatusString(profile, tempBasal,iobSum, iobDetail, bgiString);