widgets: Fix bug where process_submessages() was run for empty rows.

We now check if the row exists in the current view, and only then do we
process the submessages in it, instead of letting `Error: Failed to
do_process_submessages` happen.
This commit is contained in:
N-Shar-ma
2024-05-23 03:57:12 +05:30
committed by Tim Abbott
parent 4fcf7945b0
commit 68c83bce44

View File

@@ -90,8 +90,9 @@ export function get_message_events(message: Message): SubmessageEvents | undefin
export function process_widget_rows_in_list(list: MessageList | undefined): void { export function process_widget_rows_in_list(list: MessageList | undefined): void {
for (const message_id of widgetize.widget_event_handlers.keys()) { for (const message_id of widgetize.widget_event_handlers.keys()) {
if (list?.get(message_id) !== undefined) { const $row = list?.get_row(message_id);
process_submessages({message_id, $row: list.get_row(message_id)}); if ($row && $row.length !== 0) {
process_submessages({message_id, $row});
} }
} }
} }