Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: json deserialize error for points #29

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Portal.Gh/Components/Serialization/DeserializeGeometryComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ private PGeoType TryGetType(Payload payload)
}

string payloadJson = JsonConvert.SerializeObject(payload.Items);
JObject parsedObject = JObject.Parse(payloadJson);
JObject parsedObject;
try
{
parsedObject = JObject.Parse(payloadJson);
}
catch (JsonReaderException e)
{
return PGeoType.Undefined;
}


if (parsedObject["Type"] == null)
{
Expand Down Expand Up @@ -172,7 +181,7 @@ private Mesh DeserializeMesh(string data)
{
try
{
dynamic pPoint = JsonConvert.DeserializeObject<dynamic>(data);
PVector3D pPoint = JsonConvert.DeserializeObject<PVector3D>(data);

if (pPoint == null)
{
Expand Down