summaryrefslogtreecommitdiffstats
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2019-02-22 19:27:13 +0100
committerHein-Pieter van Braam <hp@tmm.cx>2019-02-22 19:28:19 +0100
commit4f49d09272d4885629bdde484edea875d9b45c94 (patch)
treed66d46b44bf5557c6c6f205fb3baa9e025149bef /core/ustring.cpp
parentaef5b36bfaf6b379ddeb4809312c1fc465f35779 (diff)
downloadredot-engine-4f49d09272d4885629bdde484edea875d9b45c94.tar.gz
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.
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp3
1 files changed, 3 insertions, 0 deletions
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;