From 38acd01b35401df7d5b25f562c5e387baf504789 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 16 Apr 2020 16:24:09 +0200 Subject: [PATCH] Fix issues with falsy values --- www/code/markers.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www/code/markers.js b/www/code/markers.js index c8f89069c..46c8a4a7f 100644 --- a/www/code/markers.js +++ b/www/code/markers.js @@ -203,8 +203,11 @@ console.warn(JSON.stringify(toJoin)); array[2] += addCh; // If they have no end line, it means end line === start line, // so we also push their end offset - if (!array[4] && array[3]) { array[3] += addCh; } - else if (array[4] && array[3] === toJoin.endLine) { array[4] += addCh; } + if (typeof(array[4]) === "undefined" && typeof(array[3]) !== "undefined") { + array[3] += addCh; + } else if (typeof(array[4]) !== "undefined" && array[3] === toJoin.endLine) { + array[4] += addCh; + } } });