Proper undefined/null check before running toString()