summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2018-01-20 15:28:43 +0100
committerGitHub <noreply@github.com>2018-01-20 15:28:43 +0100
commit3cd5b1fec835598b777fdfdd9f9265a495d47029 (patch)
tree609eb415aa1837e46d5af05325807ec80fff96b4
parent09732a15a50cedc4d495588f77784c26d3b3c7a7 (diff)
parent30822e8ab7735f3a715d4375292df5f0989ab788 (diff)
Merge pull request #15891 from karroffel/stringbuilder-fix-crash
fixed crash with StringBuilder
-rw-r--r--core/string_builder.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/string_builder.cpp b/core/string_builder.cpp
index 4d567cbc03..8ab7e0ea8f 100644
--- a/core/string_builder.cpp
+++ b/core/string_builder.cpp
@@ -56,6 +56,9 @@ StringBuilder &StringBuilder::append(const char *p_cstring) {
String StringBuilder::as_string() const {
+ if (string_length == 0)
+ return "";
+
CharType *buffer = memnew_arr(CharType, string_length);
int current_position = 0;