- fixed NPE in case that we don't have any time from pump (shouldn't happen)

This commit is contained in:
Andy Rozman 2021-05-20 11:43:05 +01:00
parent cae5dab285
commit 369c8a5180

View file

@ -756,7 +756,11 @@ class MedtronicHistoryData @Inject constructor(
} }
var proposedTime = DateTimeUtil.toMillisFromATD(treatment!!.atechDateTime!!) var proposedTime = DateTimeUtil.toMillisFromATD(treatment!!.atechDateTime!!)
proposedTime += (this.pumpTime!!.timeDifference * 1000)
// pumpTime should never be null, but it can theoretically happen if reading of time from pump fails
if (this.pumpTime!=null) {
proposedTime += (this.pumpTime!!.timeDifference * 1000)
}
val proposedTimeDiff : LongArray = longArrayOf(proposedTime-(2*60*1000), proposedTime+(2L*60L*1000L)) val proposedTimeDiff : LongArray = longArrayOf(proposedTime-(2*60*1000), proposedTime+(2L*60L*1000L))
val tempEntriesList: MutableList<PumpDbEntry> = mutableListOf() val tempEntriesList: MutableList<PumpDbEntry> = mutableListOf()