Fix crash at startup when there is no power.zones

This commit is contained in:
Alejandro Martinez
2021-06-05 19:56:15 -03:00
parent 316e62d27c
commit 6e4dba86f0

View File

@@ -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);