[epiphany/wip/exalm/null: 2/2] tab-view: Null check selected page




commit c38919af14358249e10101816f8834a300e9824c
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Feb 9 19:43:18 2021 +0500

    tab-view: Null check selected page
    
    The selected page can be null if there are 0 tabs, e.g. when the window has
    only just been constructed.
    
    We were doing the check in most places already, but not in these 2.
    
    Fixes https://gitlab.gnome.org/GNOME/epiphany/-/issues/1444

 src/ephy-tab-view.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/ephy-tab-view.c b/src/ephy-tab-view.c
index 18de36110..2732ce1aa 100644
--- a/src/ephy-tab-view.c
+++ b/src/ephy-tab-view.c
@@ -316,6 +316,9 @@ ephy_tab_view_get_selected_page (EphyTabView *self)
 {
   HdyTabPage *page = hdy_tab_view_get_selected_page (self->tab_view);
 
+  if (!page)
+    return NULL;
+
   return hdy_tab_page_get_child (page);
 }
 
@@ -476,7 +479,12 @@ ephy_tab_view_add_tab (EphyTabView *self,
 GtkWidget *
 ephy_tab_view_get_current_page (EphyTabView *self)
 {
-  return hdy_tab_page_get_child (get_current_page (self));
+  HdyTabPage *page = get_current_page (self);
+
+  if (!page)
+    return NULL;
+
+  return hdy_tab_page_get_child (page);
 }
 
 static void


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