Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 758cbd0

Browse files
authored
Fix crash in String when using nullptr (#10971) (#10972)
Fixes: #10971
1 parent a7907cd commit 758cbd0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎cores/esp32/WString.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ String &String::operator=(StringSumHelper &&rval) {
290290
#endif
291291

292292
String &String::operator=(const char *cstr) {
293-
return copy(cstr, strlen(cstr));
293+
const uint32_t length = cstr ? strlen(cstr) : 0u;
294+
return copy(cstr, length);
294295
}
295296

296297
/*********************************************/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /