From 405994af0d903e5d3c55b76d3a3012da9942bd2f Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 1 Sep 2017 16:50:15 +0200 Subject: [PATCH] ensure content parsable before showing it --- src/app/tabs/compile-tab.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 29974ab3ba..0c66936562 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -383,11 +383,19 @@ function compileTab (container, appAPI, appEvents, opts) { return ret } }) - node = yo`
${treeView.render(JSON.parse(details[x]))}
` + if (details[x] !== '') { + try { + node = yo`
${treeView.render(JSON.parse(details[x]))}
` // catch in case the parsing fails. + } catch (e) { + node = yo`
Unable to display "${x}": ${e.message}
` + } + } else { + node = yo`
-
` + } } else { node = yo`
${JSON.stringify(details[x], null, 4)}
` } - value.appendChild(node) + if (node) value.appendChild(node) return value }