fix: no attachment broadcast fix

This commit is contained in:
gosangam
2026-08-29 18:56:45 +05:30
parent 03c8799f22
commit 0f382ed885
4 changed files with 18 additions and 5 deletions
+6 -1
View File
@@ -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(