Fix WPK interval metric crash

.. recent update to use getWeight() in the ride file
caused a SEGV as interval metric computation is done
on the fly against a 'manufactured' ride file.

.. That ridefile doesn't have a mainwindow reference in
it, so when getWeight() references mainwindow->metricDB
a SEGV occurred.
This commit is contained in:
Mark Liversedge
2013-05-22 18:50:49 +01:00
parent 92e7ed0d23
commit bea0b1a7d1

View File

@@ -429,6 +429,7 @@ RideSummaryWindow::htmlSummary() const
bool even = false;
foreach (RideFileInterval interval, ride->intervals()) {
RideFile f(ride->startTime(), ride->recIntSecs());
f.mainwindow = mainWindow; // hack, until we refactor athlete and mainwindow
for (int i = ride->intervalBegin(interval); i < ride->dataPoints().size(); ++i) {
const RideFilePoint *p = ride->dataPoints()[i];
if (p->secs >= interval.stop)