diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-06-24 15:24:02 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-06-24 15:28:05 +0200 |
commit | 9ef81a0820c7951e6dffc047e83d83a467c128b2 (patch) | |
tree | 4da47f262fa0845dd11f91ca61e61a0261ce0dcc | |
parent | aa9bb9e40c400f9b24f530b4584229a2505af097 (diff) | |
download | network-manager-applet-9ef81a0820c7951e6dffc047e83d83a467c128b2.tar.gz |
editor: avoid crash when checking for visible children
When a connection is added the editor adds a new empty item to the
tree store with gtk_tree_store_append() and then populates
it. Therefore, has_visible_children() must be prepared to deal with
missing values.
Fixes: 4645c9ae9dd6edd41f9cae48f2de26b39f884795
https://bugzilla.redhat.com/show_bug.cgi?id=1543958
-rw-r--r-- | src/connection-editor/nm-connection-list.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c index c5d09328..ad1bde97 100644 --- a/src/connection-editor/nm-connection-list.c +++ b/src/connection-editor/nm-connection-list.c @@ -667,6 +667,11 @@ has_visible_children (NMConnectionList *self, GtkTreeModel *model, GtkTreeIter * search = gtk_entry_get_text (GTK_ENTRY (priv->search_entry)); do { gtk_tree_model_get (model, &iter, COL_ID, &id, -1); + if (!id) { + /* gtk_tree_store_append() inserts an empty row, ignore + * it until it is fully populated. */ + continue; + } if (strcasestr (id, search) != NULL) { g_free (id); return TRUE; |