summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-24 10:40:55 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-07-24 14:15:14 -0400
commitf7b73b2e010960975f1cb43fcbc9c04f82c28bb7 (patch)
tree57f3b3ea8e8d406e910eda02cfcc5014cc5105f9
parentc85e424279c2fdcb712675bb1d905d9daaf1ebf2 (diff)
downloadgtk+-f7b73b2e010960975f1cb43fcbc9c04f82c28bb7.tar.gz
sortlistmodel: Fix a crash
-rw-r--r--gtk/gtksortlistmodel.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gtk/gtksortlistmodel.c b/gtk/gtksortlistmodel.c
index f79bb77a1e..64bd038bcc 100644
--- a/gtk/gtksortlistmodel.c
+++ b/gtk/gtksortlistmodel.c
@@ -148,6 +148,9 @@ gtk_sort_list_model_get_item (GListModel *list,
if (self->model == NULL)
return NULL;
+ if (position >= self->n_items)
+ return NULL;
+
if (self->positions)
position = pos_from_key (self, self->positions[position]);