summaryrefslogtreecommitdiff
path: root/frontends/gtk/tabs.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/gtk/tabs.c')
-rw-r--r--frontends/gtk/tabs.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/frontends/gtk/tabs.c b/frontends/gtk/tabs.c
index 54aa5faf4..76fd02f89 100644
--- a/frontends/gtk/tabs.c
+++ b/frontends/gtk/tabs.c
@@ -312,14 +312,19 @@ nsgtk_tab_add_newtab(GtkNotebook *notebook)
static void
nsgtk_tab_visibility_update(GtkNotebook *notebook, GtkWidget *child, guint page)
{
- gint pagec = gtk_notebook_get_n_pages(notebook);
- GtkWidget *addpage = g_object_get_data(G_OBJECT(notebook), "addtab");
-
- if (addpage != NULL) {
- pagec--; /* skip the add tab */
- if ((gint)page == pagec) {
- /* ensure the add new tab cannot be current */
- gtk_notebook_set_current_page(notebook, page - 1);
+ gint pagec;
+ GtkWidget *addpage;
+
+ pagec = gtk_notebook_get_n_pages(notebook);
+ if (pagec > 1) {
+ addpage = g_object_get_data(G_OBJECT(notebook), "addtab");
+ if (addpage != NULL) {
+ pagec--; /* skip the add tab */
+ if ((gint)page == pagec) {
+ /* ensure the add new tab cannot be current */
+ gtk_notebook_set_current_page(notebook,
+ page - 1);
+ }
}
}