jmelosegui / GooglemapMvc

The control wraps Google maps API simplifying the use of Google maps in ASP.NET MVC applications.
MIT License
117 stars 61 forks source link

Add undefined check for "options.data" in addHeatMapLayer: function (map, options) #130

Open allanes87 opened 7 years ago

allanes87 commented 7 years ago

Hi, Firtsly, thks for this API! I found a little issue to improve: In "jmelosegui.googlemap.js", function: "addHeatMapLayer: function (map, options)", Is possible add a undefined check:

var data = [];
            **if (options.data !== undefined)**
            {
                for (var j = 0; j < options.data.length; j++) {
                    data.push(new google.maps.LatLng(options.data[j].lat, options.data[j].lng));
                }
            }

Without this little improve I have this error:

Uncaught TypeError: Cannot read property 'length' of undefined.

jmelosegui commented 7 years ago

You PR is wellcome!!!