Fix First Ride File Import Crashes

When you import the very first ride into V3 it will cause
a SEGV crash when attempting to freeMemory. This is because
the first entry added to a list does not cause any selection
to be made.

This means that the very first time someone tries to use GC
version 3 it will crash! Not the best of starts.

This bug was previously reported as being related to importing
json ride files, it occurs for ANY ride file type.

Fixes #328.
This commit is contained in:
Mark Liversedge
2011-05-21 21:31:12 +01:00
parent 34e9b482d2
commit 4c6d926780

View File

@@ -907,6 +907,10 @@ MainWindow::addRide(QString name, bool /* bSelect =true*/)
}
rideAdded(last); // here so emitted BEFORE rideSelected is emitted!
allRides->insertChild(index, last);
// if it is the very first ride, we need to select it
// after we added it
if (!index) treeWidget->setCurrentItem(last);
}
void