beyond-all-reason / beyond-all-reason/Beyond-All-Reason
Blueprints config file can be corrupted
- Dominant language
- Lua
- Stars
- 4.2k
- Forks
- 670
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 308
Description
### Description
A player reported blueprints not working, the widget crashed while trying to parse the config file. After a brief investigation I found this in their infolog:
```
[2025-04-14 21:17:45.912] [info] [t=00:45:25.688952][f=-000001] Error in Initialize(): [string "common/luaUtilities/json.lua"]:371: Unexpected character at Line 1 character 1:
[t=00:45:25.688977][f=-000001] Removed widget: Blueprint
```
I uploaded the players config file for reference.
Consider `pcall` when decoding the json config file, since the library seems to crash instead of reporting a failure to decode. In that circumstance I'd recommend removing the file altogether, since it's basically not recoverable (or do nothing if it will be overwritten on config save).
While this proposal does not fix the issue of it being possible for the config file to be corrupted, it indeed should be investigated, it does not remove part of the base game functionality due to configuration issues.
It's also perfectly possible the serialization, or saving is broken. In this case this issue is still necessary to at least ensure basic functionality availability.
[blueprints.json](https://github.com/user-attachments/files/19770361/blueprints.json)
### Expected Behaviour
Have `LuaUI/Config/blueprints.json` as the file attached.
[blueprints.json](https://github.com/user-attachments/files/19770393/blueprints.json)
The blueprints widget doesn't crash, just initializes with no configuration loaded, proposed to also remove the corrupted file (or do nothing if eventually it will be overwritten anyway on configuration save).
### Actual Behaviour
Have `LuaUI/Config/blueprints.json` as the file attached.
[blueprints.json](https://github.com/user-attachments/files/19770393/blueprints.json)
The blueprints widget crashes.
### Reproduction steps
Have `LuaUI/Config/blueprints.json` as the file attached.
[blueprints.json](https://github.com/user-attachments/files/19770393/blueprints.json)
The blueprints widget crashes.
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.