Fix "Uncaught TypeError: Cannot call method 'stub' of null"

* if the link is null, the stub is null