From 68fe5dcec691aa13dbc7ee5fa8768c11cfa6cc53 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sun, 4 Mar 2007 14:45:24 +0000 Subject: Don't crash when we cannot access the system bus. Bug #404514, patch by 2007-03-04 Christian Persch * src/ephy-net-monitor.c: (ephy_net_monitor_check_network), (ephy_net_monitor_startup): Don't crash when we cannot access the system bus. Bug #404514, patch by Jan de Groot. svn path=/trunk/; revision=6935 --- src/ephy-net-monitor.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ephy-net-monitor.c b/src/ephy-net-monitor.c index 0c2ac9a02..03f1edc25 100644 --- a/src/ephy-net-monitor.c +++ b/src/ephy-net-monitor.c @@ -111,6 +111,8 @@ ephy_net_monitor_check_network (EphyNetMonitor *monitor) DBusMessage *message; DBusPendingCall* reply; + if (priv->bus == NULL) return; + LOG ("EphyNetMonitor checking network"); /* ask to Network Manager if there is at least one active device */ @@ -248,13 +250,16 @@ ephy_net_monitor_startup (EphyNetMonitor *monitor) ephy_net_monitor_attach_to_dbus (monitor); - /* DBUS may disconnect us at any time. So listen carefully to it */ - g_signal_connect (dbus, "connected", - G_CALLBACK (connect_to_system_bus_cb), monitor); - g_signal_connect (dbus, "disconnected", - G_CALLBACK (disconnect_from_system_bus_cb), monitor); + if (monitor->priv->bus != NULL) + { + /* DBUS may disconnect us at any time. So listen carefully to it */ + g_signal_connect (dbus, "connected", + G_CALLBACK (connect_to_system_bus_cb), monitor); + g_signal_connect (dbus, "disconnected", + G_CALLBACK (disconnect_from_system_bus_cb), monitor); - ephy_net_monitor_check_network (monitor); + ephy_net_monitor_check_network (monitor); + } } static void -- cgit v1.2.3