Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
readline: handle null completer graciously
Browse files Browse the repository at this point in the history
Fixes #1698.
  • Loading branch information
bnoordhuis committed Sep 14, 2011
1 parent 244675c commit 92d4ed3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/readline.js
Expand Up @@ -45,6 +45,12 @@ function Interface(input, output, completer) {
}
EventEmitter.call(this);

completer = completer || function() { return []; };

if (typeof completer !== 'function') {
throw new TypeError("Argument 'completer' must be a function");
}

var self = this;

this.output = output;
Expand Down Expand Up @@ -605,9 +611,7 @@ Interface.prototype._ttyWrite = function(s, key) {
break;

case 'tab': // tab completion
if (this.completer) {
this._tabComplete();
}
this._tabComplete();
break;

case 'left':
Expand Down

0 comments on commit 92d4ed3

Please sign in to comment.