Fix JSON ParseError exporting settings if custom settings have never been edited.

This commit is contained in:
Glenn Maynard 2019-10-14 01:06:20 -05:00
parent 7c6b64c13e
commit 219f407246

View File

@ -508,7 +508,13 @@ namespace smx_config
static public List<object> GetCustomSensorsJSON() static public List<object> GetCustomSensorsJSON()
{ {
try {
return SMXJSON.ParseJSON.Parse<List<object>>(Properties.Settings.Default.CustomSensors); return SMXJSON.ParseJSON.Parse<List<object>>(Properties.Settings.Default.CustomSensors);
} catch(ParseError) {
// CustomSensors is empty by default. We could test if it's empty, but as a more general
// safety, just catch any JSON errors in case something invalid is saved to it.
return new List<object>();
}
} }
const int SensorLeft = 0; const int SensorLeft = 0;