diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2021-02-09 19:43:18 +0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@gnome.org> | 2021-02-09 15:26:31 +0000 |
commit | c38919af14358249e10101816f8834a300e9824c (patch) | |
tree | 956b19e3d4a6203024163ecbdcae559f67824846 | |
parent | a8a2d83e3a0ae514785569baf1867711fb2ed8eb (diff) | |
download | epiphany-c38919af14358249e10101816f8834a300e9824c.tar.gz |
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
-rw-r--r-- | src/ephy-tab-view.c | 10 |
1 files changed, 9 insertions, 1 deletions
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 |