[rhythmbox] mpris: handle returning failure with no error less badly



commit c8e54c1c432e8625b2840aa9d4c980141305f78c
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Aug 29 22:31:10 2010 +1000

    mpris: handle returning failure with no error less badly

 plugins/mpris/rb-mpris-plugin.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/plugins/mpris/rb-mpris-plugin.c b/plugins/mpris/rb-mpris-plugin.c
index c1ea793..879e107 100644
--- a/plugins/mpris/rb-mpris-plugin.c
+++ b/plugins/mpris/rb-mpris-plugin.c
@@ -280,8 +280,17 @@ handle_result (GDBusMethodInvocation *invocation, gboolean ret, GError *error)
 	if (ret) {
 		g_dbus_method_invocation_return_value (invocation, NULL);
 	} else {
-		g_dbus_method_invocation_return_gerror (invocation, error);
-		g_error_free (error);
+		if (error != NULL) {
+			rb_debug ("returning error: %s", error->message);
+			g_dbus_method_invocation_return_gerror (invocation, error);
+			g_error_free (error);
+		} else {
+			rb_debug ("returning unknown error");
+			g_dbus_method_invocation_return_error_literal (invocation,
+								       G_DBUS_ERROR,
+								       G_DBUS_ERROR_FAILED,
+								       "Unknown error");
+		}
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]