diff --git a/src/main/java/net/rptools/maptool/client/functions/json/JSONMacroFunctions.java b/src/main/java/net/rptools/maptool/client/functions/json/JSONMacroFunctions.java index c6d9f30c04..1a3c5a9779 100644 --- a/src/main/java/net/rptools/maptool/client/functions/json/JSONMacroFunctions.java +++ b/src/main/java/net/rptools/maptool/client/functions/json/JSONMacroFunctions.java @@ -872,7 +872,12 @@ private JsonElement shallowCopy(JsonElement jsonElement) { * @return The resulting json data. */ private JsonElement jsonPathDelete(JsonElement json, String path) { - return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).delete(path).json(); + try { + return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).delete(path).json(); + } catch (PathNotFoundException ex) { + // Return original json, this is to preserve backwards compatability pre library update + return json; + } } /** @@ -906,7 +911,12 @@ private JsonElement jsonPathPut(JsonElement json, String path, String key, Objec private JsonElement jsonPathSet(JsonElement json, String path, Object info) { Object value = asJsonElement(info); - return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).set(path, value).json(); + try { + return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).set(path, value).json(); + } catch (PathNotFoundException ex) { + // Return original json, this is to preserve backwards compatability pre library update + return json; + } } /**