Fix CP chart SEGV on delete ride

.. referencing combo box when in range mode.
This commit is contained in:
Mark Liversedge
2013-04-10 19:29:06 +01:00
parent a4984fd352
commit fedc2acfc5

View File

@@ -244,17 +244,25 @@ CriticalPowerWindow::forceReplot()
void
CriticalPowerWindow::newRideAdded(RideItem *here)
{
// any plots we already have are now stale
Season season = seasons->seasons.at(cComboSeason->currentIndex());
stale = true;
// mine just got Zapped, a new rideitem would not be my current item
if (here == currentRide) currentRide = NULL;
if ((here->dateTime.date() >= season.getStart() || season.getStart() == QDate())
&& (here->dateTime.date() <= season.getEnd() || season.getEnd() == QDate())) {
// replot
// any plots we already have are now stale
if (!rangemode) {
Season season = seasons->seasons.at(cComboSeason->currentIndex());
stale = true;
if ((here->dateTime.date() >= season.getStart() || season.getStart() == QDate())
&& (here->dateTime.date() <= season.getEnd() || season.getEnd() == QDate())) {
// replot
forceReplot();
}
} else {
forceReplot();
}
}