From de71435c113abf47968f1c285d8881192ff9edf9 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 4 Dec 2021 16:15:38 +0100 Subject: [PATCH] profile: clear the chart when there is nothing to display This is a shouldn't happen situation, because we always fake a profile. Let's handle it gracefully anyway. Signed-off-by: Berthold Stoeger --- profile-widget/profilescene.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/profile-widget/profilescene.cpp b/profile-widget/profilescene.cpp index e8f9d8162..5f84d9431 100644 --- a/profile-widget/profilescene.cpp +++ b/profile-widget/profilescene.cpp @@ -418,8 +418,10 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM } const struct divecomputer *currentdc = get_dive_dc_const(d, dc); - if (!currentdc || !currentdc->samples) + if (!currentdc || !currentdc->samples) { + clear(); return; + } int animSpeed = instant || printMode ? 0 : qPrefDisplay::animation_speed();