Merge pull request #879 from 0pen-dash/avereha/fix-crash

Fix Dash crash
This commit is contained in:
Milos Kozak 2021-11-08 21:34:10 +01:00 committed by GitHub
commit 24215a810b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1196,15 +1196,21 @@ class OmnipodDashPumpPlugin @Inject constructor(
val lowReservoirAlertEnabled = sp.getBoolean(R.string.key_omnipod_common_low_reservoir_alert_enabled, true)
val lowReservoirAlertUnits = sp.getInt(R.string.key_omnipod_common_low_reservoir_alert_units, 10)
if (podStateManager.sameAlertSettings(
when {
podStateManager.sameAlertSettings(
expirationReminderEnabled,
expirationHours,
lowReservoirAlertEnabled,
lowReservoirAlertUnits
)
) {
) -> {
aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because the settings did not change")
return PumpEnactResult(injector).success(true).enacted(false)
}
!podStateManager.isPodRunning -> {
aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because there is no active pod")
return PumpEnactResult(injector).success(true).enacted(false)
}
}
val podLifeLeft = Duration.between(ZonedDateTime.now(), podStateManager.expiry)
val expiryAlertDelay = podLifeLeft.minus(Duration.ofHours(expirationHours.toLong()))