From 6e4dba86f0ede3729a40ff0ea7f9b91c8e8da774 Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Date: Sat, 5 Jun 2021 19:56:15 -0300 Subject: [PATCH] Fix crash at startup when there is no power.zones --- src/Train/TrainSidebar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Train/TrainSidebar.cpp b/src/Train/TrainSidebar.cpp index d725e6ef4..9adffc899 100644 --- a/src/Train/TrainSidebar.cpp +++ b/src/Train/TrainSidebar.cpp @@ -704,7 +704,7 @@ TrainSidebar::configChanged(qint32) FTP=285; // default to 285 if zones are not set WPRIME = 20000; - int range = context->athlete->zones("Bike")->whichRange(QDate::currentDate()); + int range = context->athlete->zones("Bike") ? context->athlete->zones("Bike")->whichRange(QDate::currentDate()) : -1; if (range != -1) { FTP = context->athlete->zones("Bike")->getCP(range); WPRIME = context->athlete->zones("Bike")->getWprime(range);