diff --git a/CHANGELIST.md b/CHANGELIST.md index d41372be..d3082b2b 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -62,6 +62,7 @@ - Update README to remove AppVeyor references - Remove unused gated using statement - Add alternate config location +- Add safety check around empty config files ### 3.2.4 (2024-11-24) diff --git a/MPF.Frontend/Tools/OptionsLoader.cs b/MPF.Frontend/Tools/OptionsLoader.cs index c6b460e4..d90ffa19 100644 --- a/MPF.Frontend/Tools/OptionsLoader.cs +++ b/MPF.Frontend/Tools/OptionsLoader.cs @@ -298,7 +298,7 @@ namespace MPF.Frontend.Tools return new Options(); // Ensure the file exists - if (!File.Exists(ConfigurationPath)) + if (!File.Exists(ConfigurationPath) || new FileInfo(ConfigurationPath).Length == 0) { File.Create(ConfigurationPath).Dispose(); return new Options();