[2.0.x] Fix null check in lsDive (#10978)
This commit is contained in:
parent
d82704354f
commit
e970e429b6
|
@ -110,8 +110,8 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
||||||
createFilename(dosFilename, p);
|
createFilename(dosFilename, p);
|
||||||
|
|
||||||
// Allocate enough stack space for the full path to a folder, trailing slash, and nul
|
// Allocate enough stack space for the full path to a folder, trailing slash, and nul
|
||||||
bool prepend_is_empty = (prepend[0] == '\0');
|
const bool prepend_is_empty = (!prepend || prepend[0] == '\0');
|
||||||
int len = (prepend_is_empty ? 1 : strlen(prepend)) + strlen(dosFilename) + 1 + 1;
|
const int len = (prepend_is_empty ? 1 : strlen(prepend)) + strlen(dosFilename) + 1 + 1;
|
||||||
char path[len];
|
char path[len];
|
||||||
|
|
||||||
// Append the FOLDERNAME12/ to the passed string.
|
// Append the FOLDERNAME12/ to the passed string.
|
||||||
|
|
Loading…
Reference in a new issue