[gtk: 1/3] stack: Increase reference only if page is non-NULL




commit 0351bc766c8c84fea8800abc118c31ba5b447f22
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Wed Mar 24 19:18:02 2021 +0530

    stack: Increase reference only if page is non-NULL
    
    g_list_nth_data() may return NULL if position is off the end

 gtk/gtkstack.c | 3 +++
 1 file changed, 3 insertions(+)
---
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);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]