mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
NULL/Empty ride checks
RideItem or RideFile or dataPoints() may be null or empty. This is especially true of manual ridefiles. This patch adds some checks for this situation and acts accordingly. Additionally, the disable/enable of tabs depending upon ridefile type has been adjusted to also include files with not dataPoints.
This commit is contained in:
committed by
Sean Rhea
parent
4e7e6cfb3a
commit
d64fc6ea85
@@ -810,11 +810,18 @@ MainWindow::rideTreeWidgetSelectionChanged()
|
||||
// turn off tabs that don't make sense for manual file entry
|
||||
int histIndex = tabWidget->indexOf(histogramWindow);
|
||||
int pfpvIndex = tabWidget->indexOf(pfPvWindow);
|
||||
bool enabled = !ride->ride() || ride->ride()->deviceType() != QString("Manual CSV");
|
||||
if (histIndex >= 0)
|
||||
tabWidget->setTabEnabled(histIndex, enabled);
|
||||
if (pfpvIndex >= 0)
|
||||
tabWidget->setTabEnabled(pfpvIndex, enabled);
|
||||
int plotIndex = tabWidget->indexOf(allPlotWindow);
|
||||
int modelIndex = tabWidget->indexOf(modelWindow);
|
||||
int mapIndex = tabWidget->indexOf(googleMap);
|
||||
bool enabled = (!ride->ride() || ride->ride()->deviceType() != QString("Manual CSV"))
|
||||
&&
|
||||
(!ride->ride() ||!ride->ride()->dataPoints().isEmpty());
|
||||
|
||||
if (histIndex >= 0) tabWidget->setTabEnabled(histIndex, enabled);
|
||||
if (pfpvIndex >= 0) tabWidget->setTabEnabled(pfpvIndex, enabled);
|
||||
if (plotIndex >= 0) tabWidget->setTabEnabled(plotIndex, enabled);
|
||||
if (modelIndex >= 0) tabWidget->setTabEnabled(modelIndex, enabled);
|
||||
if (mapIndex >= 0) tabWidget->setTabEnabled(mapIndex, enabled);
|
||||
saveAndOpenNotes();
|
||||
}
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user