Merge pull request #531 from AdrianLxM/adrian156work

fix NPE when profile not loaded
This commit is contained in:
Milos Kozak 2017-12-07 15:23:32 +01:00 committed by GitHub
commit 89cf340d6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);