diff options
author | Mika Viskari <miv391@gmail.com> | 2024-03-05 20:39:00 +0200 |
---|---|---|
committer | Mika Viskari <miv391@gmail.com> | 2024-03-05 20:46:10 +0200 |
commit | 3026b566b0143977c1b184781ca9bcb37cac65b7 (patch) | |
tree | 48e66140a8a8888d0094188ba748360f469256e1 /core | |
parent | 7d80635fce1d0c44fa69d4d8cf3da40fa998f9c7 (diff) | |
download | redot-engine-3026b566b0143977c1b184781ca9bcb37cac65b7.tar.gz |
Fix String::begins_with when both strings are empty
Diffstat (limited to 'core')
-rw-r--r-- | core/string/ustring.cpp | 6 |
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; |