[tepl] Notebook: fix bug in active_tab_changed(), the tab can be NULL



commit f3d1c4734c079cec880d90992c5b14299534592b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Jul 22 21:22:10 2017 +0200

    Notebook: fix bug in active_tab_changed(), the tab can be NULL

 tepl/tepl-notebook.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/tepl/tepl-notebook.c b/tepl/tepl-notebook.c
index bff7ede..6f02966 100644
--- a/tepl/tepl-notebook.c
+++ b/tepl/tepl-notebook.c
@@ -131,13 +131,17 @@ active_tab_changed (TeplNotebook *notebook)
                         (GDestroyNotify) _tepl_signal_group_free);
 
        view = tepl_tab_group_get_active_view (TEPL_TAB_GROUP (notebook));
-       notebook->priv->view_signal_group = _tepl_signal_group_new (G_OBJECT (view));
 
-       _tepl_signal_group_add_handler_id (notebook->priv->view_signal_group,
-                                          g_signal_connect (view,
-                                                            "notify::buffer",
-                                                            G_CALLBACK (buffer_notify_cb),
-                                                            notebook));
+       if (view != NULL)
+       {
+               notebook->priv->view_signal_group = _tepl_signal_group_new (G_OBJECT (view));
+
+               _tepl_signal_group_add_handler_id (notebook->priv->view_signal_group,
+                                                  g_signal_connect (view,
+                                                                    "notify::buffer",
+                                                                    G_CALLBACK (buffer_notify_cb),
+                                                                    notebook));
+       }
 
        g_object_notify (G_OBJECT (notebook), "active-tab");
        g_object_notify (G_OBJECT (notebook), "active-view");


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