From 9cd1808057fe2f267537c4f1ccd53d73bcd4deff Mon Sep 17 00:00:00 2001 From: Mauricio Sfriso Date: Thu, 22 Mar 2018 09:27:11 -0300 Subject: [PATCH] fix: added a typeof check to prevent crash without internet connection --- src/withGoogleMap.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/withGoogleMap.jsx b/src/withGoogleMap.jsx index a4bf3c41..ec5198b0 100644 --- a/src/withGoogleMap.jsx +++ b/src/withGoogleMap.jsx @@ -56,8 +56,10 @@ export function withGoogleMap(BaseComponent) { See https://github.com/tomchentw/react-google-maps/pull/168` ) // https://developers.google.com/maps/documentation/javascript/3.exp/reference#Map - const map = new google.maps.Map(node) - this.setState({ map }) + if (typeof google !== "undefined"){ + const map = new google.maps.Map(node) + this.setState({ map }) + } } render() {