Check to make sure the event is valid before stopping propagation.

If the tree is expanded/collapsed in code, the event might be empty
so we check for a valid event now before trying to stop propagation.