From 0b6840819ed8d6fc607f1568ddff54c58af21548 Mon Sep 17 00:00:00 2001 From: amercader Date: Wed, 25 Apr 2012 12:24:43 +0100 Subject: [PATCH] [view/map,bugfix] Reapply fix from 5eb65f, lost due to a bad merge --- src/view-map.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/view-map.js b/src/view-map.js index e6537614..97d49499 100644 --- a/src/view-map.js +++ b/src/view-map.js @@ -127,10 +127,12 @@ my.Map = Backbone.View.extend({ this.bind('view:show',function(){ // If the div was hidden, Leaflet needs to recalculate some sizes // to display properly - self.map.invalidateSize(); - if (self._zoomPending && self.autoZoom) { - self._zoomToFeatures(); - self._zoomPending = false; + if (self.map){ + self.map.invalidateSize(); + if (self._zoomPending && self.autoZoom) { + self._zoomToFeatures(); + self._zoomPending = false; + } } self.visible = true; });