Added check for not enough value's
This commit is contained in:
parent
cd02fa6c0f
commit
49d2eb9f49
1 changed files with 5 additions and 0 deletions
|
@ -34,6 +34,11 @@ class AvgSmoothingPlugin @Inject constructor(
|
|||
|
||||
@Suppress("LocalVariableName")
|
||||
override fun smooth(data: MutableList<InMemoryGlucoseValue>): MutableList<InMemoryGlucoseValue> {
|
||||
if (data.lastIndex < 4)
|
||||
{
|
||||
aapsLogger.debug(LTag.GLUCOSE, "Not enough value's to smooth!")
|
||||
return data
|
||||
}
|
||||
|
||||
for (i in data.lastIndex -1 downTo 1) {
|
||||
// Check if value's are in a valid range
|
||||
|
|
Loading…
Reference in a new issue