From c891cf32caacb9f449b117fbb984e280d1a60ba5 Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Mon, 24 Dec 2018 20:06:35 +0200 Subject: [PATCH] Fix crash when checking empty string for valid hex number --- core/ustring.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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++;