Fix a crash when deleting unit views.