Prevents undefined object from being checked for values and filtered against

This commit is contained in:
GigiaJ 2025-04-27 16:48:35 -05:00
parent d6ffac74a7
commit b5ca54d6fd

View file

@ -237,6 +237,9 @@ export function RoomViewHeader() {
// I assume there is a global state so I don't have to run this check every time but for now we'll stub this in // I assume there is a global state so I don't have to run this check every time but for now we'll stub this in
const isDirectMessage = () => { const isDirectMessage = () => {
const mDirectsEvent = mx.getAccountData('m.direct'); const mDirectsEvent = mx.getAccountData('m.direct');
if (mDirectsEvent?.event?.content === undefined) {
return false;
}
const { roomId } = room; const { roomId } = room;
return ( return (
Object.values(mDirectsEvent?.event?.content).filter((e) => { Object.values(mDirectsEvent?.event?.content).filter((e) => {