diff --git a/dopt.DeltaBarth/Plugin.cs b/dopt.DeltaBarth/Plugin.cs index 1a736ea..1a20dd2 100644 --- a/dopt.DeltaBarth/Plugin.cs +++ b/dopt.DeltaBarth/Plugin.cs @@ -42,9 +42,7 @@ namespace dopt.DeltaBarth { pyJson = pyModPipeline.pipeline_sales_forecast_dummy(firmaId, buchungsDatum); } - var parsed = JsonSerializer.Deserialize(pyJson); - if (parsed == null) { throw new PythonParsingException("Could not correctly parse object from Python"); } - + var parsed = JsonSerializer.Deserialize(pyJson) ?? throw new PythonParsingException("Could not correctly parse object from Python"); return parsed; } public DataObjects.UmsatzPrognoseAusgabe Umsatzprognose(int? firmaId, DateTime? buchungsDatum) @@ -55,9 +53,7 @@ namespace dopt.DeltaBarth { pyJson = pyModPipeline.pipeline_sales_forecast(firmaId, buchungsDatum); } - var parsed = JsonSerializer.Deserialize(pyJson); - if (parsed == null) { throw new PythonParsingException("Could not correctly parse object from Python"); } - + var parsed = JsonSerializer.Deserialize(pyJson) ?? throw new PythonParsingException("Could not correctly parse object from Python"); return parsed; } protected void Setup(string datenPfad, string basisApiUrl) @@ -98,9 +94,7 @@ namespace dopt.DeltaBarth } DataObjects.Credentials? parsed = JsonSerializer.Deserialize(pyJson); - if (parsed == null) { throw new PythonParsingException("Could not correctly parse object from Python"); } - - return parsed; + return parsed ?? throw new PythonParsingException("Could not correctly parse object from Python"); } } }