mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
[Release] Add null-guard for appEvent in PersistentApp (#8176)
This commit is contained in:
parent
00d32482fa
commit
d7c1a6f33e
@ -41,15 +41,20 @@ export default class PersistentApp extends React.Component<IProps> {
|
||||
this.room = context.getRoom(this.props.persistentRoomId);
|
||||
}
|
||||
|
||||
private get app(): IApp {
|
||||
private get app(): IApp | null {
|
||||
// get the widget data
|
||||
const appEvent = WidgetUtils.getRoomWidgets(this.room).find(ev =>
|
||||
ev.getStateKey() === this.props.persistentWidgetId,
|
||||
);
|
||||
return WidgetUtils.makeAppConfig(
|
||||
appEvent.getStateKey(), appEvent.getContent(), appEvent.getSender(),
|
||||
this.room.roomId, appEvent.getId(),
|
||||
);
|
||||
|
||||
if (appEvent) {
|
||||
return WidgetUtils.makeAppConfig(
|
||||
appEvent.getStateKey(), appEvent.getContent(), appEvent.getSender(),
|
||||
this.room.roomId, appEvent.getId(),
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
|
Loading…
Reference in New Issue
Block a user