Make sure channel exists.

This commit is contained in:
Richard Lewis 2019-12-19 13:02:21 +00:00
parent 8cb49ae56a
commit d9f8f45169

View file

@ -97,11 +97,13 @@ Mousetrap.bind(["alt+a"], function() {
function jumpToChannel(targetChannel) {
switchToChannel(targetChannel);
scrollIntoViewNicely(
document.querySelector(
`#sidebar .channel-list-item[aria-controls="#chan-${targetChannel.id}"]`
)
const element = document.querySelector(
`#sidebar .channel-list-item[aria-controls="#chan-${targetChannel.id}"]`
);
if (element) {
scrollIntoViewNicely(element);
}
}
// Ignored keys which should not automatically focus the input bar