Fix soft-crash on bad permalinks

Fixes https://github.com/vector-im/riot-web/issues/12880
pull/21833/head
David Baker 2020-03-26 10:45:26 +00:00
parent 44ce5b5764
commit 9c20bf22ce
1 changed files with 11 additions and 7 deletions

View File

@ -200,13 +200,17 @@ matrixLinkify.options = {
switch (type) {
case "url": {
// intercept local permalinks to users and show them like userids (in userinfo of current room)
const permalink = parsePermalink(href);
if (permalink && permalink.userId) {
return {
click: function(e) {
matrixLinkify.onUserClick(e, permalink.userId);
},
};
try {
const permalink = parsePermalink(href);
if (permalink && permalink.userId) {
return {
click: function(e) {
matrixLinkify.onUserClick(e, permalink.userId);
},
};
}
} catch (e) {
// OK fine, it's not actually a permalink
}
break;
}