From c1de65a35aec71bba451a2dba9169591a224c2bf Mon Sep 17 00:00:00 2001 From: braniii Date: Wed, 20 Dec 2023 21:56:50 +0100 Subject: [PATCH] Prevent error, when no measurements are avail, fix #8 --- app/lib/core/interpolation.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/lib/core/interpolation.dart b/app/lib/core/interpolation.dart index 25161ba..f9fdc81 100644 --- a/app/lib/core/interpolation.dart +++ b/app/lib/core/interpolation.dart @@ -283,6 +283,11 @@ class Interpolation { /// interpolate Measurements List interpolate(InterpolFunc interpolFunc){ + // do not interpolate if empty + if (measures.isEmpty) { + return []; + } + final int dateFrom = measures.first.dateInMs - extrapolationRange; final int dateTo = measures.last.dateInMs + extrapolationRange; return [