[epiphany/gnome-42] session: validate active-tab before trying to use it



commit 14caf663379c8608f8088e803562c59ae75dede8
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Wed Feb 2 17:18:32 2022 -0600

    session: validate active-tab before trying to use it
    
    If the session state contains a bogus tab ID, validate it before passing
    it on to EphyTabView. This can happen when manually editing the session
    state.
    
    Fixes #1686
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1068>
    
    
    (cherry picked from commit 113eb528e8c4f6ba5d1e05aa2cc7f7365afc5260)

 src/ephy-session.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index af2df8f3c..5aa5609da 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -1354,7 +1354,8 @@ session_end_element (GMarkupParseContext  *ctx,
     }
 
     tab_view = ephy_window_get_tab_view (context->window);
-    ephy_tab_view_select_nth_page (tab_view, context->active_tab);
+    if (context->active_tab < ephy_tab_view_get_n_pages (tab_view))
+      ephy_tab_view_select_nth_page (tab_view, context->active_tab);
 
     if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_TEST) {
       EphyEmbed *active_child;


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