if a $var['entity'] is not set , redirect user to referred page, to avoid Fatal error: Call to a member function getIconUrl() on a non-object

if a $var['entity'] is not set , redirect user to referred page