0

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-24 02:12:34 +00:00 committed by GitHub
parent 990b720611
commit e752934fd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,8 +58,8 @@ export const TitleNotifier: FC<TitleNotifierProps> = ({ name }) => {
} }
// Only alert on real chat messages from people. // Only alert on real chat messages from people.
const lastMessage = chatMessages[chatMessages.length - 1]; const lastMessage = chatMessages.at(-1);
if (lastMessage.type !== 'CHAT') { if (!lastMessage || lastMessage.type !== 'CHAT') {
return; return;
} }