Pārlūkot izejas kodu

[2.0.x] Fix null check in lsDive (#10978)

Giuliano 7 gadus atpakaļ
vecāks
revīzija
e970e429b6
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2
    2
      Marlin/src/sd/cardreader.cpp

+ 2
- 2
Marlin/src/sd/cardreader.cpp Parādīt failu

110
       createFilename(dosFilename, p);
110
       createFilename(dosFilename, p);
111
 
111
 
112
       // Allocate enough stack space for the full path to a folder, trailing slash, and nul
112
       // Allocate enough stack space for the full path to a folder, trailing slash, and nul
113
-      bool prepend_is_empty = (prepend[0] == '\0');
114
-      int len = (prepend_is_empty ? 1 : strlen(prepend)) + strlen(dosFilename) + 1 + 1;
113
+      const bool prepend_is_empty = (!prepend || prepend[0] == '\0');
114
+      const int len = (prepend_is_empty ? 1 : strlen(prepend)) + strlen(dosFilename) + 1 + 1;
115
       char path[len];
115
       char path[len];
116
 
116
 
117
       // Append the FOLDERNAME12/ to the passed string.
117
       // Append the FOLDERNAME12/ to the passed string.

Notiek ielāde…
Atcelt
Saglabāt