[network-manager-applet] applet: avoid assertion in applet_get_active_for_connection()
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: avoid assertion in applet_get_active_for_connection()
- Date: Wed, 3 Jun 2015 09:31:50 +0000 (UTC)
commit b1c3feb227aa5f97688dcb932375761e7ec31c8e
Author: Thomas Haller <thaller redhat com>
Date: Wed Jun 3 10:57:03 2015 +0200
applet: avoid assertion in applet_get_active_for_connection()
An NMActiveConnection can return NULL as nm_connection_get_path().
Handle that case properly.
#0 0x00007ffff2addd3b in g_logv (breakpoint=1) at gmessages.c:315
#1 0x00007ffff2addd3b in g_logv (log_domain=0x7ffff4d124c6 "libnm", log_level=G_LOG_LEVEL_CRITICAL,
format=<optimized out>, args=args entry=0x7fffffffd2d0) at gmessages.c:1041
#2 0x00007ffff2addeaf in g_log (log_domain=<optimized out>, log_level=<optimized out>,
format=<optimized out>) at gmessages.c:1079
#3 0x00007ffff4c3569f in nm_connection_get_path (connection=0x0) at
../libnm-core/nm-connection.c:1437
#4 0x000000000041c376 in applet_get_active_for_connection (applet=0x6dc020 [NMApplet],
connection=0x99da60) at applet.c:431
#5 0x000000000041ba72 in nma_menu_add_vpn_submenu (menu=0xa48270 [GtkMenu], applet=0x6dc020
[NMApplet]) at applet.c:1734
#6 0x000000000041ad1f in nma_menu_show_cb (menu=0xa48270 [GtkMenu], applet=0x6dc020 [NMApplet]) at
applet.c:1915
#7 0x0000000000414fd3 in applet_update_indicator_menu (user_data=0x6dc020) at applet.c:2340
#8 0x00007ffff2ad6a8a in g_main_context_dispatch (context=0x698280) at gmain.c:3122
#9 0x00007ffff2ad6a8a in g_main_context_dispatch (context=context entry=0x698280) at gmain.c:3737
#10 0x00007ffff2ad6e20 in g_main_context_iterate (context=0x698280, block=block entry=1,
dispatch=dispatch entry=1, self=<optimized out>) at gmain.c:3808
#11 0x00007ffff2ad7142 in g_main_loop_run (loop=0x670370) at gmain.c:4002
#12 0x000000000041260a in main (argc=1, argv=0x7fffffffd8b8) at main.c:84
src/applet.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 7a1cb20..f2dcca0 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -428,10 +428,13 @@ applet_get_active_for_connection (NMApplet *applet, NMConnection *connection)
for (i = 0; active_list && (i < active_list->len); i++) {
NMActiveConnection *active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_list, i));
NMRemoteConnection *conn = nm_active_connection_get_connection (active);
- const char *active_cpath = nm_connection_get_path (NM_CONNECTION (conn));
- if (active_cpath && !strcmp (active_cpath, cpath))
- return active;
+ if (conn) {
+ const char *active_cpath = nm_connection_get_path (NM_CONNECTION (conn));
+
+ if (active_cpath && !strcmp (active_cpath, cpath))
+ return active;
+ }
}
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]