diff --git a/web/components/TitleNotifier/TitleNotifier.tsx b/web/components/TitleNotifier/TitleNotifier.tsx index dfffcc5b8..a6f3dce62 100644 --- a/web/components/TitleNotifier/TitleNotifier.tsx +++ b/web/components/TitleNotifier/TitleNotifier.tsx @@ -58,8 +58,8 @@ export const TitleNotifier: FC = ({ 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; }