Missing the check to see that link.href is defined.