Add more sanity checks to make 'enter new player name' KroArtem-proof
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6371 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
dc482e8560
commit
ac341d9e0b
@ -81,7 +81,20 @@ void EnterPlayerNameDialog::onEnterPressedInternal()
|
||||
// ---- Otherwise, accept entered name
|
||||
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
|
||||
stringw playerName = textCtrl->getText();
|
||||
if (playerName.size() > 0)
|
||||
const int size = playerName.size();
|
||||
|
||||
// sanity check
|
||||
int nonEmptyChars = 0;
|
||||
for (int n=0; n<size; n++)
|
||||
{
|
||||
if (playerName[n] != L' ')
|
||||
{
|
||||
nonEmptyChars++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (size > 0 && nonEmptyChars > 0)
|
||||
{
|
||||
const bool success = OptionsScreenPlayers::getInstance()->gotNewPlayerName( playerName );
|
||||
if (!success)
|
||||
|
Loading…
Reference in New Issue
Block a user