From 59b0ee756dd6b59e089d640f152126f4d318db80 Mon Sep 17 00:00:00 2001 From: Diego Caravana Date: Sun, 7 Feb 2016 18:52:07 +0100 Subject: [PATCH] Fix for null values causing a DOM error --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 3a8f3e9..5c574ae 100755 --- a/index.js +++ b/index.js @@ -76,7 +76,9 @@ module.exports = { div.style.marginLeft = "30px"; colon = document.createTextNode(': '); div.appendChild(strong).appendChild(colon); - div.appendChild(prettyPrint(json[keys[i]], div)); + var json_keys_i = json[keys[i]]; + if(!json_keys_i) json_keys_i = '(empty)' + div.appendChild(prettyPrint(json_keys_i, div)); if((len - i) !== 1) { div.appendChild(document.createTextNode(',')); }