Fix new Cyclist SEGV on open options dialog

The code to set the critical power for the cyclist page in the
config dialog calls zones->getCP(currentRange) when currentRange
is -1 (out of bounds). This caused a SEGV. This patch checks for
a -1 value and sets CP to 0 rather than calling zones->getCP.
This commit is contained in:
Mark Liversedge
2009-12-17 20:42:04 +00:00
committed by Sean Rhea
parent a3ae0ee314
commit 78716c3f4b

View File

@@ -226,7 +226,7 @@ CyclistPage::CyclistPage(const Zones *_zones):
checkboxNew->setCheckState(Qt::Unchecked);
}
int cp = zones->getCP(currentRange);
int cp = currentRange != -1 ? zones->getCP(currentRange) : 0;
if (cp > 0)
setCP(cp);