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.

recent_topics: Handle no rows case on `r` keypress.

Aman Agrawalcf5a154413d3
diff --git a/static/js/recent_topics_ui.js b/static/js/recent_topics_ui.js
index 591302dea29..a62255888ef 100644
--- a/static/js/recent_topics_ui.js
+++ b/static/js/recent_topics_ui.js
@@ -154,6 +154,10 @@ export function get_focused_row_message() {
if (is_table_focused()) {
const recent_topic_id_prefix_len = "recent_topic:".length;
const topic_rows = $("#recent_topics_table table tbody tr");
+ if (topic_rows.length === 0) {
+ return undefined;
+ }
+
const topic_row = topic_rows.eq(row_focus);
const topic_id = topic_row.attr("id").slice(recent_topic_id_prefix_len);
const topic_last_msg_id = topics.get(topic_id).last_msg_id;