diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2018-12-24 20:06:35 +0200 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2018-12-24 20:06:35 +0200 |
commit | c891cf32caacb9f449b117fbb984e280d1a60ba5 (patch) | |
tree | 4c9b42a534504a1f6fb485e4b23866684b35417b | |
parent | 10e9221c49eddc05cb36c0b582060cac9e4c8cef (diff) |
Fix crash when checking empty string for valid hex number
-rw-r--r-- | core/ustring.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 083a1eaed6..d8b804d484 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3578,9 +3578,12 @@ bool String::is_valid_integer() const { bool String::is_valid_hex_number(bool p_with_prefix) const { - int from = 0; int len = length(); + if (len == 0) + return false; + + int from = 0; if (len != 1 && (operator[](0) == '+' || operator[](0) == '-')) from++; |