Skip to content

Commit

Permalink
Also don't throw exception if JSON has wrong prop
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed Nov 19, 2024
1 parent 69ef260 commit 075cd63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/LexBoxApi/Services/HgService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ private string[] GetWsList(System.Xml.XmlElement root, string tagName)
try
{
var json = JsonDocument.Parse(text);
if (json.RootElement.GetProperty("modelversion").TryGetInt32(out int version)) return version;
_logger.LogError("Invalid model version in GetModelVersionOfFlexProject, should be a number but got {modelversion}", json.RootElement.GetProperty("modelversion").ToString());
if (json.RootElement.TryGetProperty("modelversion", out var modelversion) && modelversion.TryGetInt32(out int version)) return version;
_logger.LogError("Invalid JSON {text} in GetModelVersionOfFlexProject, should have one property \"modelversion\" that's a number", text);
return null;
}
catch (JsonException e)
Expand Down

0 comments on commit 075cd63

Please sign in to comment.