[nautilus-sendto] Fix possible crasher in Bluetooth plugin
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-sendto] Fix possible crasher in Bluetooth plugin
- Date: Mon, 1 Feb 2010 14:56:38 +0000 (UTC)
commit ce027b0b83038d36e7be0116e4d2a472e310f605
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 21 15:18:42 2010 +0000
Fix possible crasher in Bluetooth plugin
Avoid crashing when the dbus_g_proxy_call() fails but returns
no error.
https://bugzilla.redhat.com/show_bug.cgi?id=554142
src/plugins/bluetooth/bluetooth.c | 31 +++++++++++++++++--------------
1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/plugins/bluetooth/bluetooth.c b/src/plugins/bluetooth/bluetooth.c
index 972a87b..f2db2dd 100644
--- a/src/plugins/bluetooth/bluetooth.c
+++ b/src/plugins/bluetooth/bluetooth.c
@@ -81,22 +81,25 @@ init (NstPlugin *plugin)
if (dbus_g_proxy_call (manager, "DefaultAdapter", &e,
G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, &adapter, G_TYPE_INVALID) == FALSE) {
g_object_unref (manager);
- if (e->domain == DBUS_GERROR &&
- e->code == DBUS_GERROR_REMOTE_EXCEPTION) {
- const char *name;
+ if (e != NULL) {
+ if (e->domain == DBUS_GERROR &&
+ e->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+ const char *name;
- name = dbus_g_error_get_name (e);
+ name = dbus_g_error_get_name (e);
- /* No adapter */
- if (g_str_equal (name, "org.bluez.Error.NoSuchAdapter") != FALSE) {
- g_error_free (e);
- return FALSE;
+ /* No adapter */
+ if (g_str_equal (name, "org.bluez.Error.NoSuchAdapter") != FALSE) {
+ g_error_free (e);
+ return FALSE;
+ }
}
+ g_warning ("Couldn't get default bluetooth adapter: %s",
+ e->message);
+ g_error_free (e);
+ } else {
+ g_warning ("Couldn't get default bluetooth adapter: No error given");
}
-
- g_warning ("Couldn't get default bluetooth adapter: %s",
- e->message);
- g_error_free (e);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]