From 74403c1881910de401db8a045906a37e5e5cbfa7 Mon Sep 17 00:00:00 2001 From: vash15 Date: Thu, 27 Oct 2016 15:48:39 +0200 Subject: [PATCH] Bugfix into method getFirstInstanceFromClassType --- bower.json | 2 +- lib/viewstack.js | 5 +++-- package.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 6c4c9d6..0ccf3a2 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "backbone.viewstack", - "version": "2.1.1", + "version": "2.1.3", "homepage": "https://github.com/vash15/backbone.viewstack", "authors": [ "Michele Belluco ", diff --git a/lib/viewstack.js b/lib/viewstack.js index 2ced797..c6238b9 100644 --- a/lib/viewstack.js +++ b/lib/viewstack.js @@ -139,9 +139,10 @@ }, getFirstInstanceFromClassType: function getFirstInstanceFromClassType(classType) { - return _.find(this._stack, function (aView) { - return aView instanceof classType; + var r = _.find(this._stack, function (aItem) { + return _.isObject(aItem) && aItem.view instanceof classType; }); + return r ? r.view : null; }, getZIndex: function () { diff --git a/package.json b/package.json index b3f7cd2..e409606 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backbone.viewstack", - "version": "2.1.2", + "version": "2.1.3", "description": "View stack for Backbone", "main": "lib/viewstack.js", "repository": {