From 6637ce32cfcfd3236460910da322321dd07c9b12 Mon Sep 17 00:00:00 2001 From: = Date: Fri, 1 Sep 2017 15:07:18 -0400 Subject: [PATCH] Caught errors from bad json in object editor fields. If there was an ace editor field whose type was 'object', and the getValue was called when the entered json was invalid, it would throw an error. Wrapped the JSON.parse call in a try catch block and upon failure, it will set it to null. --- src/js/fields/advanced/EditorField.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/js/fields/advanced/EditorField.js b/src/js/fields/advanced/EditorField.js index e788b2736..95e5cdbbb 100644 --- a/src/js/fields/advanced/EditorField.js +++ b/src/js/fields/advanced/EditorField.js @@ -363,7 +363,14 @@ } else { - value = JSON.parse(value); + //don't throw error if user entered bad json + try { + value = JSON.parse(value); + } + catch(err){ + //bad json + value = null; + } } }