Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

rendered_markdown: Fix TypeScript noUncheckedIndexedAccess errors.

Anders Kaseorgfcf2e607c289
diff --git a/web/src/rendered_markdown.ts b/web/src/rendered_markdown.ts
index af364d60950..45658b3579e 100644
--- a/web/src/rendered_markdown.ts
+++ b/web/src/rendered_markdown.ts
@@ -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()