From 32fe815ea268e16f7603e554784aa9b5dc19cdec Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 7 Dec 2015 19:15:15 -0700 Subject: [PATCH] Ensure top() exists before attempting to return instance --- core/menu_stack.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/menu_stack.js b/core/menu_stack.js index f8bc18f6..ed855897 100644 --- a/core/menu_stack.js +++ b/core/menu_stack.js @@ -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; + } };