1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Fix String::begins_with when both strings are empty

(cherry picked from commit 3026b566b0)
This commit is contained in:
Mika Viskari
2024-03-05 20:39:00 +02:00
committed by Rémi Verschelde
parent 4e3cd10173
commit 02e6c0ab95
2 changed files with 42 additions and 27 deletions

View File

@@ -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;