Ensure top() exists before attempting to return instance

This commit is contained in:
Bryan Ashby 2015-12-07 19:15:15 -07:00
parent 6af0861dfe
commit 32fe815ea2
1 changed files with 4 additions and 1 deletions

View File

@ -145,5 +145,8 @@ MenuStack.prototype.goto = function(name, options, cb) {
};
MenuStack.prototype.getCurrentModule = function() {
return this.top().instance;
var top = this.top();
if(top) {
return top.instance;
}
};