From ace0857a77f361e45447a592d64182874fb3c7a2 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Thu, 27 Jun 2019 13:07:43 +0200 Subject: [PATCH] header may be missing in case of invalid file --- VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs index ddc382aa28..f6fe87d632 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs @@ -67,7 +67,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON protected JSONFile(JObject data, string filename, bool tolerateMissing = false) { var header = (JObject)data.GetEx(JsonKeys.JsonHeader); - Version = header.GetEx<string>(JsonKeys.JsonHeader_FileVersion); + Version = header[JsonKeys.JsonHeader_FileVersion] != null ? header.GetEx<string>(JsonKeys.JsonHeader_FileVersion) : string.Empty; Body = (JObject)data.GetEx(JsonKeys.JsonBody); _sourceFile = Path.GetFullPath(filename); TolerateMissing = tolerateMissing; -- GitLab