summaryrefslogtreecommitdiffstats
path: root/core/string/ustring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/string/ustring.cpp')
-rw-r--r--core/string/ustring.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index f4b00255a1..1d27933016 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -3329,10 +3329,14 @@ bool String::begins_with(const String &p_string) const {
bool String::begins_with(const char *p_string) const {
int l = length();
- if (l == 0 || !p_string) {
+ if (!p_string) {
return false;
}
+ if (l == 0) {
+ return *p_string == 0;
+ }
+
const char32_t *str = &operator[](0);
int i = 0;