Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix null-guarding regression around reply_to_event dispatch (#8039)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Mar 11, 2022
1 parent 5262d5c commit 4b0df21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
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();
Expand Down
2 changes: 1 addition & 1 deletion src/stores/RoomViewStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class RoomViewStore extends Store<ActionPayload> {
// 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<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: payload.event.getRoomId(),
Expand Down

0 comments on commit 4b0df21

Please sign in to comment.