From f7b73b2e010960975f1cb43fcbc9c04f82c28bb7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Jul 2020 10:40:55 -0400 Subject: [PATCH] sortlistmodel: Fix a crash --- gtk/gtksortlistmodel.c | 3 +++ 1 file changed, 3 insertions(+) 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]);