summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Sadiq <sadiq@sadiqpk.org>2021-03-24 19:18:02 +0530
committerMohammed Sadiq <sadiq@sadiqpk.org>2021-03-24 20:21:13 +0530
commit0351bc766c8c84fea8800abc118c31ba5b447f22 (patch)
tree85e8baa3deca8fd85c8f728f3be327b7cd3e961b
parent5531906973dff9e0f0f9004545ed0794a65866ac (diff)
downloadgtk+-0351bc766c8c84fea8800abc118c31ba5b447f22.tar.gz
stack: Increase reference only if page is non-NULL
g_list_nth_data() may return NULL if position is off the end
-rw-r--r--gtk/gtkstack.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 41aa4958b5..9b1488b3b2 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -538,6 +538,9 @@ gtk_stack_pages_get_item (GListModel *model,
page = g_list_nth_data (priv->children, position);
+ if (!page)
+ return NULL;
+
return g_object_ref (page);
}