Fix right-click crash on ridelist with no rides

When there are no rides to select in the ride list (e.g. when
just created a new user) right click for a context menu will
crash since it assumes there will always be a ride selected.
This commit is contained in:
Mark Liversedge
2011-07-30 12:13:16 +01:00
parent 3cc9c62b34
commit e2d5e3678e

View File

@@ -640,6 +640,8 @@ MainWindow::rideTreeWidgetSelectionChanged()
void
MainWindow::showTreeContextMenuPopup(const QPoint &pos)
{
if (treeWidget->selectedItems().size() == 0) return; //none selected!
RideItem *rideItem = (RideItem *)treeWidget->selectedItems().first();
if (rideItem != NULL && rideItem->text(0) != tr("All Rides")) {
QMenu menu(treeWidget);