Fix null pointer dereference in map editor