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_view: Fix error when user has no messages.

Aman Agrawalcd48ee21522b
diff --git a/web/src/recent_view_ui.js b/web/src/recent_view_ui.js
index 347158b6ba3..ae566f0d06d 100644
--- a/web/src/recent_view_ui.js
+++ b/web/src/recent_view_ui.js
@@ -136,7 +136,8 @@ export function set_oldest_message_date(msg_list_data) {
const has_found_oldest = msg_list_data.fetch_status.has_found_oldest();
const has_found_newest = msg_list_data.fetch_status.has_found_newest();
- oldest_message_timestamp = Math.min(msg_list_data.first().timestamp, oldest_message_timestamp);
+ const first_message_timestamp = msg_list_data.first()?.timestamp ?? Number.POSITIVE_INFINITY;
+ oldest_message_timestamp = Math.min(first_message_timestamp, oldest_message_timestamp);
if (has_found_oldest) {
loading_state = ALL_MESSAGES_LOADED;