Fix invalid events crashing entire room rather than just their tile (#31256)
* Fix invalid events crashing entire room rather than just their tile Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
184e6e3f29
commit
29ff8a6199
@@ -939,7 +939,13 @@ for (const evType of ElementCallEventType.names) {
|
||||
*/
|
||||
export function hasText(ev: MatrixEvent, client: MatrixClient, showHiddenEvents?: boolean): boolean {
|
||||
const handler = (ev.isState() ? stateHandlers : handlers)[ev.getType()];
|
||||
return Boolean(handler?.(ev, client, false, showHiddenEvents));
|
||||
try {
|
||||
return Boolean(handler?.(ev, client, false, showHiddenEvents));
|
||||
} catch (e) {
|
||||
console.error(`Error encountered when trying to render event type=${ev.getType()} id=${ev.getId()}`, e);
|
||||
// Returning true if we have a handler so we can show an error tile rather than no tile at all
|
||||
return !!handler;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user