summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp5
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++;