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) {