check for no profile

This commit is contained in:
Milos Kozak 2018-01-25 11:09:58 +01:00
parent 7be0bfb27e
commit a3e6794138

View file

@ -637,6 +637,11 @@ public class WatchUpdaterService extends WearableListenerService implements
private String generateBasalString(TreatmentsInterface treatmentsInterface) {
String basalStringResult;
Profile profile = MainApp.getConfigBuilder().getProfile();
if (profile == null)
return "";
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
if (activeTemp != null) {
basalStringResult = activeTemp.toStringShort();
@ -644,7 +649,7 @@ public class WatchUpdaterService extends WearableListenerService implements
if (SP.getBoolean(R.string.key_danar_visualizeextendedaspercentage, false)) {
basalStringResult = "100%";
} else {
basalStringResult = DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getProfile().getBasal()) + "U/h";
basalStringResult = DecimalFormatter.to2Decimal(profile.getBasal()) + "U/h";
}
}
return basalStringResult;