gracefully handle info url failures - fixes #12

This commit is contained in:
silverwind 2018-11-27 23:34:57 +01:00
parent 1548e394d6
commit 372941bafe
Signed by: silverwind
GPG Key ID: 2E62B41C93869443

@ -171,7 +171,8 @@ const get = async name => {
const getInfoUrl = ({repository, homepage}) => {
if (repository) {
const gitUrl = typeof repository === "string" ? repository : repository.url;
return require("hosted-git-info").fromUrl(gitUrl).browse();
const info = require("hosted-git-info").fromUrl(gitUrl);
if (info && info.browse) return info.browse();
}
return homepage || "";