MDT: prevent ArrayIndexOutOfBoundsException
This commit is contained in:
parent
c1290ce766
commit
c3a52c5969
1 changed files with 4 additions and 0 deletions
|
@ -94,6 +94,10 @@ class MedtronicConverter @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun decodeTime(rawContent: ByteArray): LocalDateTime? {
|
fun decodeTime(rawContent: ByteArray): LocalDateTime? {
|
||||||
|
if (rawContent.size < 7) {
|
||||||
|
aapsLogger.error(LTag.PUMPCOMM, "decodeTime: Byte array too short")
|
||||||
|
return null
|
||||||
|
}
|
||||||
val hours = ByteUtil.asUINT8(rawContent[0])
|
val hours = ByteUtil.asUINT8(rawContent[0])
|
||||||
val minutes = ByteUtil.asUINT8(rawContent[1])
|
val minutes = ByteUtil.asUINT8(rawContent[1])
|
||||||
val seconds = ByteUtil.asUINT8(rawContent[2])
|
val seconds = ByteUtil.asUINT8(rawContent[2])
|
||||||
|
|
Loading…
Reference in a new issue