Bug fix, allocate string to store ledmap name

This commit is contained in:
Ewoud
2023-05-29 18:33:49 +02:00
committed by Frank
parent 49f2e26ab5
commit 5081cfb891
2 changed files with 8 additions and 4 deletions

View File

@@ -1364,7 +1364,8 @@ void WS2812FX::enumerateLedmaps() {
f = WLED_FS.open(fileName, "r");
if (f) {
f.find("\"n\":");
const char *name = f.readStringUntil('\n').c_str();
char name[33];
f.readBytesUntil('\n', name, sizeof(name));
USER_PRINTF("enumerateLedmaps %s %s\n", fileName, name);
size_t len = 0;
@@ -2139,10 +2140,13 @@ bool WS2812FX::deserializeMap(uint8_t n) {
//WLEDMM: read width and height (mandatory in file!!)
f.find("\"width\":");
uint16_t maxWidth = f.readStringUntil('\n').toInt();
f.readBytesUntil('\n', fileName, sizeof(fileName)); //hack: use fileName as we have this allocated already
uint16_t maxWidth = atoi(fileName);
f.find("\"height\":");
uint16_t maxHeight = f.readStringUntil('\n').toInt();
f.readBytesUntil('\n', fileName, sizeof(fileName));
uint16_t maxHeight = atoi(fileName);
USER_PRINTF("deserializeMap %d x %d\n", maxWidth, maxHeight);
if (maxWidth * maxHeight <= 0) {

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2305260
#define VERSION 2305290
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG