javisar/ONI-Modloader-Mods

Better error handling in config file reader

Opened this issue · 1 comments

Being in need of a config file reader, I found the one in SpeedControlConfig.cs.

It seems to work just fine, but I managed to crash the mod when not using the config file correctly. I expanded on the function to never crash and make it use default values in case it fails to read what it needs from the config file.

Here is the updated version. Feel free to use it if you like.

Thank you for the tip. I didn't realize that malformed json could cause issues. To be honest this was a quick solution and I'm waiting until presumably Klei adds a built in mod config support.