prevent NPE
This commit is contained in:
parent
feb2d9045a
commit
c6438f5df9
1 changed files with 3 additions and 3 deletions
|
@ -182,19 +182,19 @@ class ActionStringHandler @Inject constructor(
|
|||
return
|
||||
}
|
||||
val bgReading = iobCobCalculatorPlugin.actualBg()
|
||||
if (bgReading == null && useBG) {
|
||||
if (bgReading == null) {
|
||||
sendError("No recent BG to base calculation on!")
|
||||
return
|
||||
}
|
||||
val cobInfo = iobCobCalculatorPlugin.getCobInfo(false, "Wizard wear")
|
||||
if (useCOB && (cobInfo.displayCob == null)) {
|
||||
if (cobInfo.displayCob == null) {
|
||||
sendError("Unknown COB! BG reading missing or recent app restart?")
|
||||
return
|
||||
}
|
||||
val format = DecimalFormat("0.00")
|
||||
val formatInt = DecimalFormat("0")
|
||||
val bolusWizard = BolusWizard(injector).doCalc(profile, profileName, activePlugin.activeTreatments.tempTargetFromHistory,
|
||||
carbsAfterConstraints, cobInfo.displayCob!!, bgReading!!.valueToUnits(profileFunction.getUnits()),
|
||||
carbsAfterConstraints, cobInfo.displayCob, bgReading.valueToUnits(profileFunction.getUnits()),
|
||||
0.0, percentage.toDouble(), useBG, useCOB, useBolusIOB, useBasalIOB, false, useTT, useTrend, false)
|
||||
if (Math.abs(bolusWizard.insulinAfterConstraints - bolusWizard.calculatedTotalInsulin) >= 0.01) {
|
||||
sendError("Insulin constraint violation!" +
|
||||
|
|
Loading…
Reference in a new issue