Fix robustness issue: empty JSON {} in cfg.json or wsec.json#355
Fix robustness issue: empty JSON {} in cfg.json or wsec.json#355softhack007 merged 8 commits intomdevfrom
{} in cfg.json or wsec.json#355Conversation
Agent-Logs-Url: https://github.com/MoonModules/WLED-MM/sessions/f446b25c-8344-4ded-8cb3-61c246c5ab5b Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MoonModules/WLED-MM/sessions/92f2e0c0-5bab-4607-9e9f-7f48416a7da3 Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
…omment Agent-Logs-Url: https://github.com/MoonModules/WLED-MM/sessions/92f2e0c0-5bab-4607-9e9f-7f48416a7da3 Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MoonModules/WLED-MM/sessions/3ceab8b4-0b22-4361-8e78-9b95793cf1c2 Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
|
@coderabbitai please review. This PR is intended to solve the "empty JSON" corner case identified in #343, plus handle empty presets.json (e.g. |
🧩 Analysis chain🏁 Script executed: Length of output: 2235 Let me check the 🏁 Script executed: Length of output: 710 🏁 Script executed: Length of output: 10271
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe changes improve handling of empty or incomplete JSON configuration files. Both config and presets initialization functions now detect empty files and rebuild them instead of accepting minimal or zero-length JSON as valid initialization states. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* clarify the logic inside the "early return" path * use "<4" as threshold for "empty"
initPresetsFile()in presets.cpp: remove theszlocal variable, usebool empty = f && f.size() < 3instead — cleaner and equally correctSummary by CodeRabbit