fix TitleNotifier crash (#3100)

rare chance of crashing when using ReactRefresh with an empty chat

Co-authored-by: janWilejan <>
This commit is contained in:
janWilejan
2023-06-23 19:12:34 -07:00
committed by GitHub
co-authored by janWilejan <>
parent 990b720611
commit e752934fd5
@@ -58,8 +58,8 @@ export const TitleNotifier: FC<TitleNotifierProps> = ({ name }) => {
}
// Only alert on real chat messages from people.
const lastMessage = chatMessages[chatMessages.length - 1];
if (lastMessage.type !== 'CHAT') {
const lastMessage = chatMessages.at(-1);
if (!lastMessage || lastMessage.type !== 'CHAT') {
return;
}