Skip to content

Commit 7fd0d1a

Browse files
committed
Attempt to fix the config.json file getting rm'd
1 parent 5564777 commit 7fd0d1a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,14 @@ void Wippersnapper_FS::CreateFileConfig() {
381381
File32 file_cfg = wipperFatFs_v2.open("/config.json", FILE_READ);
382382
if (file_cfg) {
383383
DeserializationError error = deserializeJson(_doc_cfg, file_cfg);
384-
// if (error)
385-
// HaltFilesystem("Error unable to parse config.json on WIPPER drive!");
386-
// Remove config from the filesystem
384+
if (error) {
385+
// If we can't deserialize, just raise
386+
HaltFilesystem(
387+
"[fs] Error: Unable to deserialize config.json, is it corrupted?");
388+
}
389+
// We are going to parse the in-memory object, _doc_cfg, rather
390+
// than the file. So, let's remove the ctg file since we'll replace
391+
// it with a new cfg file later on
387392
file_cfg.close();
388393
wipperFatFs_v2.remove("/config.json");
389394
flash_v2.syncBlocks();
@@ -404,6 +409,7 @@ void Wippersnapper_FS::CreateFileConfig() {
404409
// Build components array
405410
_doc_cfg["components"].to<JsonArray>();
406411
}
412+
407413
return;
408414
}
409415
}

0 commit comments

Comments
 (0)