Merge pull request #1994 from Philoul/Fix/FixNPE_Autotune

Fix NPE AutotuneIob
This commit is contained in:
Milos Kozak 2022-08-08 11:23:00 +02:00 committed by GitHub
commit 764794bdaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -381,9 +381,11 @@ open class AutotuneIob @Inject constructor(
} }
} }
TherapyEvent.Type.COMBO_BOLUS -> TherapyEvent.Type.COMBO_BOLUS ->
extendedBolus?.let { extendedBolus?.let { ebr ->
val profile = profileFunction.getProfile(it.timestamp) val profile = profileFunction.getProfile(ebr.timestamp)
it.toJson(true, profile!!, dateUtil) profile?.let {
ebr.toJson(true, it, dateUtil)
}
} }
TherapyEvent.Type.CORRECTION_BOLUS -> bolusTreatment?.toJson(true, dateUtil) TherapyEvent.Type.CORRECTION_BOLUS -> bolusTreatment?.toJson(true, dateUtil)
TherapyEvent.Type.CARBS_CORRECTION -> carbsTreatment?.toJson(true, dateUtil) TherapyEvent.Type.CARBS_CORRECTION -> carbsTreatment?.toJson(true, dateUtil)