Skip to content

Commit

Permalink
Merge pull request #457 from gkrzystek/master
Browse files Browse the repository at this point in the history
fix config write failure related crash
  • Loading branch information
mozzwald authored Jul 6, 2021
2 parents b3dd111 + f567d46 commit eeb50a3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/config/fnConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,20 @@ void fnConfig::save()
if (fnConfig::get_general_fnconfig_spifs() == true) //only if spiffs is enabled
{
Debug_println("SPIFFS Config Storage: Enabled. Saving config to SPIFFS");
fout = fnSPIFFS.file_open(CONFIG_FILENAME, "w");
if ( !(fout = fnSPIFFS.file_open(CONFIG_FILENAME, "w")))
{
Debug_println("Failed to Open config on SPIFFS");
return;
}
}
else
{
Debug_println("SPIFFS Config Storage: Disabled. Saving config to SD");
fout = fnSDFAT.file_open(CONFIG_FILENAME, "w");
if ( !(fout = fnSDFAT.file_open(CONFIG_FILENAME, "w")))
{
Debug_println("Failed to Open config on SD");
return;
}
}
std::string result = ss.str();
size_t z = fwrite(result.c_str(), 1, result.length(), fout);
Expand Down

0 comments on commit eeb50a3

Please sign in to comment.