From f9afd4bac9821e68e433168d5262fea7cb220052 Mon Sep 17 00:00:00 2001 From: Sebastian Holstein Date: Mon, 24 Sep 2018 20:06:36 +0200 Subject: [PATCH] fix(Map): fitBounds values that are undefined/null fixes #1505 fixes #1504 --- packages/core/directives/map.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/core/directives/map.ts b/packages/core/directives/map.ts index ac1454abf..9b805f8d3 100644 --- a/packages/core/directives/map.ts +++ b/packages/core/directives/map.ts @@ -475,14 +475,11 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy { } protected _updateBounds(bounds: LatLngBounds|LatLngBoundsLiteral) { - if (this._isLatLngBoundsLiteral(bounds)) { + if (this._isLatLngBoundsLiteral(bounds) && google && google.maps) { const newBounds = google.maps.LatLngBounds(); newBounds.union(bounds); bounds = newBounds; } - if (bounds.isEmpty()) { - return; - } if (this.usePanning) { this._mapsWrapper.panToBounds(bounds); return; @@ -491,7 +488,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy { } private _isLatLngBoundsLiteral(bounds: LatLngBounds|LatLngBoundsLiteral): bounds is LatLngBoundsLiteral { - return (bounds).extend === undefined; + return bounds != null && (bounds).extend === undefined; } private _handleMapCenterChange() {