Fix WPrime CP lookup SEGV

.. when zones or cp not set for the date in question

Fixes #774.
This commit is contained in:
Mark Liversedge
2014-01-26 16:22:00 +00:00
parent f727c6270e
commit 8974ba2d2f

View File

@@ -535,8 +535,8 @@ class WPrimeExp : public RideMetric {
const Context *) {
int cp = r->getTag("CP","0").toInt();
if (!cp) cp = zones->getCP(zonerange);
if (!cp && zones && zonerange >=0) cp = zones->getCP(zonerange);
double total = 0;
double secs = 0;
foreach(const RideFilePoint *point, r->dataPoints()) {