Fixes #648 Crash in standings menu when after last event of a championship

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4637 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: a5648b20a774400cbf269ba9b48b77f4da5c8e0d
Former-commit-id: eb879c4f8ed8d2485f40d24eb4024c29b29c5816
This commit is contained in:
pouillot 2012-03-31 17:29:35 +00:00
parent fca1a42bd1
commit 7ff6d70389

View file

@ -596,9 +596,10 @@ GfTrack* GfRaceManager::getPreviousEventTrack(unsigned nEventIndex)
if (nEventIndex >= _vecEventTrackIds.size())
nEventIndex = _vecEventTrackIds.size() - 1;
if (nEventIndex >= 1)
pTrack =
GfTracks::self()->getTrack(_vecEventTrackIds[nEventIndex - 1]);
const unsigned nPrevEventIndex = // Beware: Previous of 1st = last.
(nEventIndex > 0) ? nEventIndex - 1 : _vecEventTrackIds.size() - 1;
pTrack = GfTracks::self()->getTrack(_vecEventTrackIds[nPrevEventIndex]);
}
return pTrack;