From 79fbf92764fe6a017b1859f910be957dd0f76515 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 25 Apr 2009 20:45:01 +0000 Subject: [PATCH] fix for crash on all zeros string from Daniel Lemon --- stepmania/src/RollingNumbers.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RollingNumbers.cpp b/stepmania/src/RollingNumbers.cpp index 7e5ca2de13..8e74ad5d91 100644 --- a/stepmania/src/RollingNumbers.cpp +++ b/stepmania/src/RollingNumbers.cpp @@ -36,12 +36,13 @@ void RollingNumbers::DrawPrimitives() RString s = this->GetText(); int i; - // find the first non-zero, non-comma character - for( i=0; i<(int)s.length(); i++ ) + // find the first non-zero non-comma character, or the last character + for( i=0; i<(int)(s.length()-1); i++ ) { - if( s[i] != '0' && s[i] != ',' ) + if( s[i] != '0' && s[i] != ',' ) break; } + // Rewind to the first number, even if it's a zero. If the string is "0000", we want the last zero to show in the regular color. for( ; i>=0; i-- ) {