Skip to content

Commit 3d64d2b

Browse files
cjihrigtargos
authored andcommitted
readline: check for null input in question()
question() checks for objects passed as the recently added options argument. This commit improves that logic to also check for null. PR-URL: #37089 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent fe9f4fd commit 3d64d2b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎lib/readline.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ Interface.prototype.prompt = function(preserveCursor) {
364364

365365
Interface.prototype.question=function(query,options,cb){
366366
cb=typeofoptions==='function' ? options : cb;
367-
options=typeofoptions==='object' ? options : {};
367+
options=typeofoptions==='object'&&options!==null? options : {};
368368

369369
if(options.signal){
370370
options.signal.addEventListener('abort',()=>{
@@ -385,7 +385,7 @@ Interface.prototype.question = function(query, options, cb) {
385385
};
386386

387387
Interface.prototype.question[promisify.custom]=function(query,options){
388-
options=typeofoptions==='object' ? options : {};
388+
options=typeofoptions==='object'&&options!==null? options : {};
389389

390390
returnnewPromise((resolve,reject)=>{
391391
this.question(query,options,resolve);

0 commit comments

Comments
 (0)