fix for crash on all zeros string from Daniel Lemon

This commit is contained in:
Chris Danford
2009-04-25 20:45:01 +00:00
parent 41a6b57454
commit 79fbf92764
+4 -3
View File
@@ -36,12 +36,13 @@ void RollingNumbers::DrawPrimitives()
RString s = this->GetText(); RString s = this->GetText();
int i; int i;
// find the first non-zero, non-comma character // find the first non-zero non-comma character, or the last character
for( i=0; i<(int)s.length(); i++ ) for( i=0; i<(int)(s.length()-1); i++ )
{ {
if( s[i] != '0' && s[i] != ',' ) if( s[i] != '0' && s[i] != ',' )
break; 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. // 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-- ) for( ; i>=0; i-- )
{ {