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




commit 5e4ac07ba4f9f5f491655742d97000454ba86465
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

 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]