diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 637394324e9..0cb0c0a7fde 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -4934,6 +4934,10 @@ bool String::is_valid_hex_number(bool p_with_prefix) const { from += 2; } + if (from == len) { + return false; + } + for (int i = from; i < len; i++) { char32_t c = operator[](i); if (is_hex_digit(c)) {