From 4f49d09272d4885629bdde484edea875d9b45c94 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Fri, 22 Feb 2019 19:27:13 +0100 Subject: Don't crash when parse_utf8 receives a NULL pointer This can happen when chaining calls to various string methods when the string is empty. --- core/ustring.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/ustring.cpp') diff --git a/core/ustring.cpp b/core/ustring.cpp index b9914fb530..ff8fcaaaaf 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -1359,6 +1359,9 @@ bool String::parse_utf8(const char *p_utf8, int p_len) { #define _UNICERROR(m_err) print_line("Unicode error: " + String(m_err)); + if (!p_utf8) + return true; + String aux; int cstr_size = 0; -- cgit v1.2.3