Skip to content

Commit

Permalink
+ fix possible crash in InputField::selectNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jun 10, 2014
1 parent 82b8df5 commit 2320e99
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Gui/InputField.cpp
Expand Up @@ -450,8 +450,16 @@ void InputField::selectNumber(void)
QByteArray str = text().toLatin1();
unsigned int i = 0;

while ( (str.at(i) >= '0' && str.at(i) <= '9') || str.at(i)== ',' || str.at(i)== '.'|| str.at(i)== '-' )
i++;
for (QByteArray::iterator it = str.begin(); it != str.end(); ++it) {
if (*it >= '0' && *it <= '9')
i++;
else if (*it == ',' || *it == '.')
i++;
else if (*it == '-')
i++;
else // any non-number character
break;
}

setSelection(0,i);
}
Expand Down

0 comments on commit 2320e99

Please sign in to comment.