Google maps: is null or not an object error

I’ve got a google maps application on an ASP.NET ajax enabled page through an update panel. I had used setInterval to run a javscript function periodically and update the markers on the map. Over time, I noticed that when the map was updated through ajax while the javascript code was executing, i got the one of the following two errors:

'__e_' is null or not an object
'undefined' is null or not an object

These errors didn’t seem to have any effect, other than a javascript error being noted.

Through debugging, I determined that it was because of GEvent.addListener(), GEvent.clearListeners(), and marker.setImage(). Because I was getting real time updates, it was ok if every once in a while these things didn’t get updated – I could just ignore it and it probably will be updated next round. So, if you simply put these calls in a try/catch block, the errors don’t get generated.

try
{
	marker.setImage(newImagePath);
}
catch(err){} //it's ok to fail here - ignore it.

Good luck!


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *