Add a check for non-existing collection

Add a check before trying to output a link to the collection that does not exist.