summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
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++;