listbase: Don't warn on scroll in empty list

Empty lists can still be scrolled if the scroll happens in the same
frame as the emptying of the list.

Related: #5763
This commit is contained in:
Benjamin Otte
2023-04-20 19:07:08 +02:00
parent 75c47755e3
commit f393f70ee2

View File

@@ -214,6 +214,11 @@ gtk_list_base_adjustment_value_changed_cb (GtkAdjustment *adjustment,
&pos,
&cell_area))
{
/* If we get here with n-items == 0, then somebody cleared the list but
* GC hasn't run. So no item to be found. */
if (gtk_list_base_get_n_items (self) == 0)
return;
g_warning ("%s failed to scroll to given position. Ignoring...", G_OBJECT_TYPE_NAME (self));
return;
}