savePreset() fix mutex leak in early return path

early return considered harmful 😆
This commit is contained in:
Frank
2025-12-29 21:17:02 +01:00
parent 91dc9a5b5a
commit b863cf3ed8

View File

@@ -336,7 +336,10 @@ void savePreset(byte index, const char* pname, JsonObject sObj)
}
presetToSave = 0;
if (index > 250 || !fileDoc) return; // cannot save API calls to temporary preset (255)
if (index > 250 || !fileDoc) {
esp32SemGive(presetFileMux); // Release file mutex
return; // cannot save API calls to temporary preset (255)
}
sObj.remove("o");
sObj.remove("v");
sObj.remove("time");