Editor: fix a possible NullPointerException when opening an invalid map.
Fix dangling pointers after removing some kind of entities.