[devhelp] SearchBar: handle NULL search entry in grab_focus_to_search_entry()



commit 9684baa2a825b8a46fffce76e64ebad9b1b29535
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Dec 19 13:48:36 2019 +0100

    SearchBar: handle NULL search entry in grab_focus_to_search_entry()
    
    It can happen if the function is called:
    - after init() but before constructed().
    - after dispose() but before finalize().

 devhelp/dh-search-bar.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/devhelp/dh-search-bar.c b/devhelp/dh-search-bar.c
index eb39b712..42cb3c0b 100644
--- a/devhelp/dh-search-bar.c
+++ b/devhelp/dh-search-bar.c
@@ -378,6 +378,9 @@ dh_search_bar_grab_focus_to_search_entry (DhSearchBar *search_bar)
 {
         g_return_if_fail (DH_IS_SEARCH_BAR (search_bar));
 
+       if (search_bar->priv->search_entry == NULL)
+               return;
+
         gtk_widget_grab_focus (GTK_WIDGET (search_bar->priv->search_entry));
         gtk_editable_select_region (GTK_EDITABLE (search_bar->priv->search_entry), 0, -1);
 }


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