Closed webdobe closed 10 years ago
I fixed by doing:
if (!data || Object.keys(data).length === 0) { return { latlng: e.latlng, data: null }; }
Is this a good fix? Should I submit a patch?
Sounds like it could be on the right track, would it be possible to upload an example? I'm interested in seeing how you have this set up so you get an empty data object.
I am just playing around with the plugin and had a problem at the same line. I have created my maps and exported .mbtiles-files with TileMill, and there I made the bounds small than a whole map. So this is why I got errors afterwards in the browser. The suggested code has stopped those errors for me.
Ditto. Indeed, webdobe's code fixes all. Thanks webdobe.
Can anyone please upload an example that causes the error so I can confirm and add the fix? thanks!
Awesome, thanks. Have pushed a new version with a fix, please test it out! :)
I have a base map layer that fits the whole map div (which has no data caked in). I have added a layer that in this case is just 1 state surrounded by nothing but the base map. When you hover outside of the state map an empty data object is being passed and throwing errors for every mouse movement. The problem happens at:
line 145ish of source. var idx = this._utfDecode(data.grid[gridY].charCodeAt(gridX)),
basically the object passed for "data" is empty I believe the code at 142 needs to be looking for a null data object and an empty.