summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@redhat.com>2022-02-02 17:18:32 -0600
committerAlexander Mikhaylenko <alexm@gnome.org>2022-03-01 13:57:39 +0000
commit113eb528e8c4f6ba5d1e05aa2cc7f7365afc5260 (patch)
tree420c05f2464c9296fd61406e74948ff0c1f63530 /src
parent8659347a51b43f5b15b91ad4bc5c38e6e5bbc5b1 (diff)
downloadepiphany-113eb528e8c4f6ba5d1e05aa2cc7f7365afc5260.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/ephy-session.c3
1 files changed, 2 insertions, 1 deletions
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;