Don't try to set a non-existing page at startup
And print a proper warning should this occur somewhere else later on.
This commit is contained in:
parent
448e119b0b
commit
69c229b7a7
2 changed files with 10 additions and 3 deletions
|
@ -1312,11 +1312,12 @@ midori_load_session (gpointer data)
|
|||
midori_browser_add_item (browser, item);
|
||||
}
|
||||
current = katze_item_get_meta_integer (KATZE_ITEM (_session), "current");
|
||||
if (current < 0)
|
||||
current = 0;
|
||||
midori_browser_set_current_page (browser, current);
|
||||
if (!(item = katze_array_get_nth_item (_session, current)))
|
||||
{
|
||||
current = 0;
|
||||
item = katze_array_get_nth_item (_session, 0);
|
||||
}
|
||||
midori_browser_set_current_page (browser, current);
|
||||
if (!g_strcmp0 (katze_item_get_uri (item), ""))
|
||||
midori_browser_activate_action (browser, "Location");
|
||||
|
||||
|
|
|
@ -6876,8 +6876,14 @@ void
|
|||
midori_browser_set_current_page (MidoriBrowser* browser,
|
||||
gint n)
|
||||
{
|
||||
gint n_pages;
|
||||
GtkWidget* view;
|
||||
|
||||
g_return_if_fail (MIDORI_IS_BROWSER (browser));
|
||||
|
||||
n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
|
||||
g_return_if_fail (n < n_pages);
|
||||
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
|
||||
view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n);
|
||||
if (midori_view_is_blank (MIDORI_VIEW (view)))
|
||||
|
|
Loading…
Reference in a new issue