From de437e73d3c35b91892bcbd59828e22fb8eb4b72 Mon Sep 17 00:00:00 2001 From: phromo Date: Wed, 31 Oct 2018 09:10:47 +0100 Subject: [PATCH] fix null reference on empty cell. fixes #14 --- lib/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index c3fa9d2..4002709 100644 --- a/lib/main.js +++ b/lib/main.js @@ -183,7 +183,9 @@ class PythonKernelMod { // is indented the same amount. However, this only works if the first line // is indented. We therefore trim empty lines at the start of the executed // region. - code = code.replace(/^\n|\n$/g, ''); + if (code != null) { + code = code.replace(/^\n|\n$/g, ''); + } next.execute(code, (msg, channel) => { if (!makeReply && msg.parent_header) {