From 73239fc40825584447482d55f2862a2b1c422ee2 Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:06:02 +0100 Subject: [PATCH] patch json decode to return null if something goes wrong --- LibreMetaverse.StructuredData/JSON/OSDJson.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/LibreMetaverse.StructuredData/JSON/OSDJson.cs b/LibreMetaverse.StructuredData/JSON/OSDJson.cs index d3ec21a..0ddef3a 100644 --- a/LibreMetaverse.StructuredData/JSON/OSDJson.cs +++ b/LibreMetaverse.StructuredData/JSON/OSDJson.cs @@ -20,7 +20,16 @@ namespace OpenMetaverse.StructuredData public static OSD DeserializeJson(string json) { - return DeserializeJson(JsonMapper.ToObject(json)); + try + { + JsonData A = JsonMapper.ToObject(json); + return DeserializeJson(A); + } + catch + { + return null; // something fucky happened to the input + } + } public static OSD DeserializeJson(JsonData json)