From 536bfb33877afdc8f74f076d3ae55827a65a76aa Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 28 Apr 2023 16:59:14 -0400 Subject: [PATCH] Reminder that `typeof null` is 'object' Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/discussions/2619#discussioncomment-5757274 --- src/js/support.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/support.js b/src/js/support.js index dc39ae851..80d45cad3 100644 --- a/src/js/support.js +++ b/src/js/support.js @@ -145,12 +145,12 @@ function renderData(data, depth = 0) { } return out.join('\n'); } - if ( typeof data !== 'object' ) { + if ( typeof data !== 'object' || data === null ) { return `${indent}${data}`; } const out = []; for ( const [ name, value ] of Object.entries(data) ) { - if ( typeof value === 'object' ) { + if ( typeof value === 'object' && value !== null ) { out.push(`${indent}${name}:`); out.push(renderData(value, depth + 1)); continue;