Skip to content

Commit 12b3bed

Browse files
authored
cleanup - removed old code in comments
1 parent f78edc4 commit 12b3bed

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

wled00/util.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,7 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
342342
} else {
343343
// WLEDMM bugfix for WLED-MM #272
344344
// names.substring(...).c_str() returns a pointer to a temporary; it’s invalid by the next statement. Added result buffer "sub" to avoid use-after-free
345-
// if (nameEnd<0) tmpstr = names.substring(nameBegin).c_str(); // did not find ",", last name?
346-
// else tmpstr = names.substring(nameBegin, nameEnd).c_str();
347-
// strlcpy(dest, tmpstr, maxLen); // copy the name into buffer (replacing previous)
348-
String sub = (nameEnd<0) ? names.substring(nameBegin) : names.substring(nameBegin, nameEnd);
345+
String sub = (nameEnd<0) ? names.substring(nameBegin) : names.substring(nameBegin, nameEnd); // special handling in case we did not find "," (last name)
349346
strlcpy(dest, sub.c_str(), maxLen); // copy the name into buffer (replacing previous)
350347
}
351348
}

0 commit comments

Comments
 (0)