diff --git a/lib/OpenLayers/Layer/Google.js b/lib/OpenLayers/Layer/Google.js index 947478b9c7..3263458195 100644 --- a/lib/OpenLayers/Layer/Google.js +++ b/lib/OpenLayers/Layer/Google.js @@ -134,43 +134,36 @@ OpenLayers.Layer.Google.prototype = Object.extend( new OpenLayers.Layer(), { loadGMap:function() { //has gmaps library has been loaded? - var gmapsLoaded = (typeof GMap2) != "undefined"; - if (!gmapsLoaded) { - this.loadWarningMessage(); - } else { - + try { // create GMap, hide nav controls this.gmap = new GMap2(this.div); - - if (this.gmap == null) { - this.loadWarningMessage(); - } else { - // this causes the GMap to set itself to Map's center/zoom - this.moveTo(); - - // catch pans and zooms from GMap - GEvent.addListener(this.gmap, - "moveend", - this.catchPanZoom.bindAsEventListener(this)); - - - // attach to the drag start and end and weŽll set a flag so that - // we dont get recursivity. this is because when we call setCenter(), - // it calls moveTo() on all layers - GEvent.addListener(this.gmap, - "dragstart", - this.dragStart.bindAsEventListener(this)); - - GEvent.addListener(this.gmap, - "dragend", - this.dragEnd.bindAsEventListener(this)); - - // catch pans and zooms from GMap - GEvent.addListener(this.gmap, - "drag", - this.catchPanZoom.bindAsEventListener(this)); - } + // this causes the GMap to set itself to Map's center/zoom + this.moveTo(); + + // catch pans and zooms from GMap + GEvent.addListener(this.gmap, + "moveend", + this.catchPanZoom.bindAsEventListener(this)); + + + // attach to the drag start and end and weŽll set a flag so that + // we dont get recursivity. this is because when we call setCenter(), + // it calls moveTo() on all layers + GEvent.addListener(this.gmap, + "dragstart", + this.dragStart.bindAsEventListener(this)); + + GEvent.addListener(this.gmap, + "dragend", + this.dragEnd.bindAsEventListener(this)); + + // catch pans and zooms from GMap + GEvent.addListener(this.gmap, + "drag", + this.catchPanZoom.bindAsEventListener(this)); + } catch (e) { + this.loadWarningMessage(); } },