Fix String::begins_with when both strings are empty

This commit is contained in:
Mika Viskari 2024-03-05 20:39:00 +02:00
parent 7d80635fce
commit 3026b566b0
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;