From 4b0df21b0aeecef5cd59f4909d91c81ad24fa271 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 11 Mar 2022 17:21:28 +0000 Subject: [PATCH] Fix null-guarding regression around reply_to_event dispatch (#8039) --- src/components/structures/RoomView.tsx | 2 +- src/stores/RoomViewStore.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index e57184604c5..b6591bc2b7e 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -844,7 +844,7 @@ export class RoomView extends React.Component { case 'reply_to_event': if (!this.unmounted && this.state.searchResults && - payload.event.getRoomId() === this.state.roomId && + payload.event?.getRoomId() === this.state.roomId && payload.context === TimelineRenderingType.Search ) { this.onCancelSearchClick(); diff --git a/src/stores/RoomViewStore.tsx b/src/stores/RoomViewStore.tsx index d6ee527f8bd..e7f5e2ecb23 100644 --- a/src/stores/RoomViewStore.tsx +++ b/src/stores/RoomViewStore.tsx @@ -201,7 +201,7 @@ class RoomViewStore extends Store { // this can happen when performing a search across all rooms. Persist the data from this event for // both room and search timeline rendering types, search will get auto-closed by RoomView at this time. if ([TimelineRenderingType.Room, TimelineRenderingType.Search].includes(payload.context)) { - if (payload.event?.getRoomId() !== this.state.roomId) { + if (payload.event && payload.event.getRoomId() !== this.state.roomId) { dis.dispatch({ action: Action.ViewRoom, room_id: payload.event.getRoomId(),