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

master
Glenn Maynard 5 years ago
parent 7c6b64c13e
commit 219f407246
  1. 6
      smx-config/Helpers.cs

@ -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;

Loading…
Cancel
Save