rendered_markdown: Fix TypeScript noUncheckedIndexedAccess errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-30 10:07:59 -07:00
parent 8417b54035
commit fcf2e607c2
1 changed files with 6 additions and 2 deletions

View File

@ -296,7 +296,11 @@ export const update_elements = ($content: JQuery): void => {
// popover listing the options.
let title = $t({defaultMessage: "View in playground"});
const $view_in_playground_button = $buttonContainer.find(".code_external_link");
if (playground_info && playground_info.length === 1) {
if (
playground_info &&
playground_info.length === 1 &&
playground_info[0] !== undefined
) {
title = $t(
{defaultMessage: "View in {playground_name}"},
{playground_name: playground_info[0].name},
@ -327,7 +331,7 @@ export const update_elements = ($content: JQuery): void => {
$content
.find(".emoji")
.text(function () {
const text = $(this).attr("title");
const text = $(this).attr("title") ?? "";
return ":" + text + ":";
})
.contents()