fix: no attachment broadcast fix
This commit is contained in:
+6
-1
@@ -29,10 +29,15 @@ export function buildEntityTree(
|
||||
body: string,
|
||||
entities: MessageEntity[],
|
||||
): EntityNode[] {
|
||||
// Defensive on both inputs: this renders content from the network, and a
|
||||
// missing body should show nothing rather than take down the screen it is
|
||||
// on. The broadcast modal renders through here too, and it mounts on every
|
||||
// page — so a crash here is not confined to chat.
|
||||
const text = body ?? "";
|
||||
const sorted = [...(entities ?? [])].sort(
|
||||
(a, b) => a.offset - b.offset || b.length - a.length,
|
||||
);
|
||||
return build(body, 0, body.length, sorted);
|
||||
return build(text, 0, text.length, sorted);
|
||||
}
|
||||
|
||||
function build(
|
||||
|
||||
Reference in New Issue
Block a user