File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments