Guard against null handler in ajax event