[network-manager-applet/bg/fix-editor-crash: 1/2] editor: avoid crash when checking for visible children
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/bg/fix-editor-crash: 1/2] editor: avoid crash when checking for visible children
- Date: Mon, 24 Jun 2019 13:35:21 +0000 (UTC)
commit 9ef81a0820c7951e6dffc047e83d83a467c128b2
Author: Beniamino Galvani <bgalvani redhat com>
Date: Mon Jun 24 15:24:02 2019 +0200
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
src/connection-editor/nm-connection-list.c | 5 +++++
1 file changed, 5 insertions(+)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]