Fix crash in String when using nullptr (#10971) (#10972)

Fixes: #10971
This commit is contained in:
TD-er 2025-02-17 14:27:41 +01:00 committed by GitHub
parent a7907cd07e
commit 758cbd097d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -290,7 +290,8 @@ String &String::operator=(StringSumHelper &&rval) {
#endif
String &String::operator=(const char *cstr) {
return copy(cstr, strlen(cstr));
const uint32_t length = cstr ? strlen(cstr) : 0u;
return copy(cstr, length);
}
/*********************************************/