Skip to content

Commit

Permalink
fix(Map): fitBounds values that are undefined/null
Browse files Browse the repository at this point in the history
fixes #1505
fixes #1504
  • Loading branch information
sebholstein committed Sep 24, 2018
1 parent 7d76659 commit a365b1c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/core/directives/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <LatLngBounds>google.maps.LatLngBounds();
newBounds.union(bounds);
bounds = newBounds;
}
if (bounds.isEmpty()) {
return;
}
if (this.usePanning) {
this._mapsWrapper.panToBounds(bounds);
return;
Expand All @@ -491,7 +488,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
}

private _isLatLngBoundsLiteral(bounds: LatLngBounds|LatLngBoundsLiteral): bounds is LatLngBoundsLiteral {
return (<any>bounds).extend === undefined;
return bounds != null && (<any>bounds).extend === undefined;
}

private _handleMapCenterChange() {
Expand Down

0 comments on commit a365b1c

Please sign in to comment.