don't try to add event listener with a null function

this was throwing exceptions in firefox