From 5eb65f2b77deb997f2a4e8de9f709328736cc907 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Tue, 17 Apr 2012 05:27:09 +0100 Subject: [PATCH] [view-map,bugfix][xs]: only call invalidateMapsize on view:show if map defined. * this issue arose in case when map is the first view being shown. --- src/view-map.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view-map.js b/src/view-map.js index 6759c55e..9ceb07b1 100644 --- a/src/view-map.js +++ b/src/view-map.js @@ -117,7 +117,9 @@ my.Map = Backbone.View.extend({ // If the div was hidden, Leaflet needs to recalculate some sizes // to display properly this.bind('view:show',function(){ - self.map.invalidateSize(); + if (self.map) { + self.map.invalidateSize(); + } }); var stateData = _.extend({