Fixed Course::GetTotalSeconds to work on courses that don't have a medium difficulty. A course with only double charts was probably the one that made the crash manifest.

This commit is contained in:
Kyzentun
2014-08-02 00:38:39 -07:00
committed by Jonathan Payne
parent 1a18d64f09
commit 2e43a70752
+17 -2
View File
@@ -823,9 +823,24 @@ bool Course::GetTotalSeconds( StepsType st, float& fSecondsOut ) const
if( !AllSongsAreFixed() )
return false;
Trail* pTrail = GetTrail( st, Difficulty_Medium );
Trail* trail = GetTrail( st, Difficulty_Medium );
if(!trail)
{
for(int cd= 0; cd < NUM_CourseDifficulty; ++cd)
{
trail= GetTrail(st, (CourseDifficulty)cd);
if(trail)
{
break;
}
}
if(!trail)
{
return false;
}
}
fSecondsOut = pTrail->GetLengthSeconds();
fSecondsOut = trail->GetLengthSeconds();
return true;
}