Check obj exists before attempting to perform "querySelectorAll"

fixes: Uncaught TypeError: Cannot read property 'querySelectorAll' of undefined
when mail widget is used on dashboard and a user isn't logged in
Better fix
Merge pull request #814 from thybag/bug/dashboard-mail-notloggedin

Fix (very) minor bug