summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;