From c6ef91fde70741fccf6502009d251d585382b30a Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Thu, 31 Jul 2025 09:13:48 +0200 Subject: [PATCH] file exists --- Pilz/Data/Json/JsonFileContainer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Pilz/Data/Json/JsonFileContainer.cs b/Pilz/Data/Json/JsonFileContainer.cs index c8b5abf..06fdac7 100644 --- a/Pilz/Data/Json/JsonFileContainer.cs +++ b/Pilz/Data/Json/JsonFileContainer.cs @@ -8,8 +8,11 @@ public class JsonFileContainer(string filePath) : JsonDataContainer { lock (_lock_FileAction) { - using var sw = new StreamReader(filePath); - GetSerializer().Populate(sw, this); + if (File.Exists(filePath)) + { + using var sw = new StreamReader(filePath); + GetSerializer().Populate(sw, this); + } } }