message_list: Fix exception with nonexistent streams.

If the stream no longer exists, we don't need to try to show a stream
resubscribe UI.
This commit is contained in:
Tim Abbott
2017-09-15 01:56:34 -07:00
parent c330c75e3c
commit 27bb680aa5

View File

@@ -392,8 +392,14 @@ exports.MessageList.prototype = {
if (!this.last_message_historical) {
trailing_bookend_content = this.unsubscribed_bookend_content(stream_name);
// For invite only streams, hide the resubscribe button
show_button = !stream_data.get_sub(stream_name).invite_only;
// For invite only streams or streams that no longer
// exist, hide the resubscribe button
var sub = stream_data.get_sub(stream_name);
if (sub !== undefined) {
show_button = !sub.invite_only;
} else {
show_button = false;
}
} else {
trailing_bookend_content = this.not_subscribed_bookend_content(stream_name);
}