[gnome-settings-daemon] media-keys: Don't crash when there are no listeners
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Don't crash when there are no listeners
- Date: Mon, 15 Nov 2010 17:30:42 +0000 (UTC)
commit 0760395d13348df88e742198ff3109d3f5d7a779
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 15 17:29:55 2010 +0000
media-keys: Don't crash when there are no listeners
No listening application means no application, and GVariant doesn't
like NULL when it should be an empty string.
plugins/media-keys/gsd-media-keys-manager.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 1d6afd8..2cc9ce5 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -884,6 +884,8 @@ gsd_media_player_key_pressed (GsdMediaKeysManager *manager,
gboolean have_listeners;
GError *error = NULL;
+ g_return_val_if_fail (key != NULL, FALSE);
+
g_debug ("Media key '%s' pressed", key);
have_listeners = (manager->priv->media_players != NULL);
@@ -897,7 +899,7 @@ gsd_media_player_key_pressed (GsdMediaKeysManager *manager,
GSD_MEDIA_KEYS_DBUS_PATH,
GSD_MEDIA_KEYS_DBUS_NAME,
"MediaPlayerKeyPressed",
- g_variant_new ("(ss)", application, key),
+ g_variant_new ("(ss)", application ? application : "", key),
&error) == FALSE) {
g_debug ("Error emitting signal: %s", error->message);
g_error_free (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]