more escape character checking

This commit is contained in:
Isaac0-dev 2025-02-21 11:03:48 +10:00
parent a1f96a97fa
commit 215056b1d2

View file

@ -331,12 +331,13 @@ bool djui_panel_player_name_valid(char* buffer) {
if (buffer[0] == '\0') { return false; }
u16 numEscapeChars = 0;
bool isOnlyEscapeChars = true;
bool isInEscapedChar = false;
char* c = buffer;
while (*c != '\0') {
if (*c == ' ') { return false; }
if (!djui_unicode_valid_char(c)) { return false; }
if (*c == '\\') { numEscapeChars++; }
else { isOnlyEscapeChars = false; }
if (*c == '\\') { numEscapeChars++; isInEscapedChar = !isInEscapedChar; }
else if (!isInEscapedChar) { isOnlyEscapeChars = false; }
c = djui_unicode_next_char(c);
}
if (isOnlyEscapeChars) { return false; }