summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-01-04 16:19:29 +0100
committerGitHub <noreply@github.com>2019-01-04 16:19:29 +0100
commit70de8ca9a9baf93de2280c313d039e8f8ef96f8c (patch)
treeacac32b859d0ebbae12d45e7dab69f7d5201f8bb /core
parentd8f0087dc8d3c3bcdddbb681eb204e70fd76898a (diff)
parentc891cf32caacb9f449b117fbb984e280d1a60ba5 (diff)
Merge pull request #24585 from Xrayez/fix-crash-hex-number
Fix crash when checking empty string for valid hex number
Diffstat (limited to 'core')
-rw-r--r--core/ustring.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 23ea3f3617..75fe36dd37 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++;