summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseniy Movshev <dodoradio@outlook.com>2023-06-30 10:13:13 +0100
committerArseniy Movshev <dodoradio@outlook.com>2023-06-30 10:14:09 +0100
commit73a26015844091c43425e6a549ed05ec0e61c197 (patch)
tree2b9aae82ff7551a82dee55d006c11fb9f04982be
parentea4354b3e1c01549e9c27e6b0918cc7efca3af91 (diff)
Check for data size before trying to load heartrate data
-rw-r--r--src/cpp/hrGraph.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cpp/hrGraph.cpp b/src/cpp/hrGraph.cpp
index ea42b13..ccec424 100644
--- a/src/cpp/hrGraph.cpp
+++ b/src/cpp/hrGraph.cpp
@@ -77,6 +77,10 @@ void HrGraph::paint(QPainter *painter)
void HrGraph::loadGraphData(QVariant fileDataInput) {
qDebug() << "loadGraphData called";
QList<QVariant> fileDataAsList = fileDataInput.toList();
+ if (fileDataAsList.count() < 1) {
+ qDebug() << "no heartrate data to show, failing load";
+ return;
+ }
int j = fileDataAsList.count();
minTime = fileDataAsList[0].toPoint().x();
maxTime = fileDataAsList[j-1].toPoint().x();