Fix for 1191 (detachEventHandler causing undefined index in CListIterator)

Modify CComponent to handle if an eventHandler has been removed while iterating over the event handlers.

fixes #1191 
This modification is not necessary. If current array element is not set we'll get `null` and notice. In your code we will get `null` too. I can't see the difference