Change _theme_entityreference_pageshow() to properly handle the editing of an entity that doesn't have an referenced entities attached to it.