CodeCabin / wp-google-maps

WP Google Maps
16 stars 12 forks source link

PRO :: `marker-listing.js` #1017

Closed shazahm1 closed 2 years ago

shazahm1 commented 2 years ago

In the WPGMZA.MarkerListing.prototype.onHTMLResponse function the code does not check for a null return type when calling map.getMarkerByID(marker_id) which causes an error.

The code as it is in version 8.1.20.

            var map = self.map;
            var marker_id = $(el).closest("[data-marker-id]").attr("data-marker-id");
            var marker = map.getMarkerByID(marker_id);

            if(!marker.gallery)
                return;

            var gallery = new WPGMZA.MarkerGallery(marker, self);

Should be:

            var map = self.map;
            var marker_id = $(el).closest("[data-marker-id]").attr("data-marker-id");
            var marker = map.getMarkerByID(marker_id);

            if( null === marker || !marker.hasOwnProperty('gallery') ) {
                return;
            }

            var gallery = new WPGMZA.MarkerGallery(marker, self);
shazahm1 commented 2 years ago

@DylanCodeCabin

DylanCodeCabin commented 2 years ago

Thank you for logging this @shazahm1 -> We'll get this check added to the V9 builds before launch! 🚀

DylanCodeCabin commented 2 years ago

This has been patched in our V9.0.0 builds, which have a confirmed release date of 2022-06-20

Thank you @shazahm1