Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MarkerWithLabel: Cannot read property 'removeChild' of null
  • Loading branch information
sestegra committed Apr 4, 2018
1 parent cc81533 commit 363099d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/js/markerwithlabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,15 @@ MarkerLabel_.prototype.onAdd = function () {
*/
MarkerLabel_.prototype.onRemove = function () {
var i;
this.labelDiv_.parentNode.removeChild(this.labelDiv_);
if (this.labelDiv_.parentNode) {
this.labelDiv_.parentNode.removeChild(this.labelDiv_);
}

// Remove event listeners:
for (i = 0; i < this.listeners_.length; i++) {
google.maps.event.removeListener(this.listeners_[i]);
if (this.listeners_) {
for (i = 0; i < this.listeners_.length; i++) {
google.maps.event.removeListener(this.listeners_[i]);
}
}
};

Expand Down

0 comments on commit 363099d

Please sign in to comment.