From ba0a0c69d2ec83da18b81250d75cc4bce00a8495 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 23 Jul 2014 13:25:04 -0600 Subject: [PATCH] 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. --- src/Course.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Course.cpp b/src/Course.cpp index 3231dbed94..73528353e0 100644 --- a/src/Course.cpp +++ b/src/Course.cpp @@ -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; }