diff --git a/lib/readline.js b/lib/readline.js index bad4774a6a4162..1ffe0d9b5e23b4 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -372,7 +372,7 @@ Interface.prototype.prompt = function(preserveCursor) { Interface.prototype.question = function(query, options, cb) { cb = typeof options === 'function' ? options : cb; - options = typeof options === 'object' ? options : {}; + options = typeof options === 'object' && options !== null ? options : {}; if (options.signal) { options.signal.addEventListener('abort', () => { @@ -393,7 +393,7 @@ Interface.prototype.question = function(query, options, cb) { }; Interface.prototype.question[promisify.custom] = function(query, options) { - options = typeof options === 'object' ? options : {}; + options = typeof options === 'object' && options !== null ? options : {}; return new Promise((resolve, reject) => { this.question(query, options, resolve);