Don't scroll to message log bottom with no messages (GTK client) (#3959)

Fixes: #3956
This commit is contained in:
Mike Gelfand 2022-10-13 16:19:37 -07:00 committed by GitHub
parent a2817faab1
commit 02cbfa917a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -123,14 +123,15 @@ bool MessageLogWindow::Impl::is_pinned_to_new() const
void MessageLogWindow::Impl::scroll_to_bottom()
{
if (sort_ != nullptr)
auto const row_count = sort_->children().size();
if (row_count == 0)
{
auto const row_count = sort_->children().size();
return;
}
if (auto const iter = sort_->children()[row_count - 1]; iter)
{
view_->scroll_to_row(sort_->get_path(TR_GTK_TREE_MODEL_CHILD_ITER(iter)), 1);
}
if (auto const iter = sort_->children()[row_count - 1]; iter)
{
view_->scroll_to_row(sort_->get_path(TR_GTK_TREE_MODEL_CHILD_ITER(iter)), 1);
}
}