aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-06-11 17:25:31 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-06-11 17:25:31 +0000
commit0517b25ec28abbd239009887edbae1684995c560 (patch)
treee193fc58c3137c53a849787351ff3063b6e8e2ce /src
parent9a1ce3c40437c5ca36e3fa0cacf80025c83bb65a (diff)
parentd038c85495317daee3d036a48d519acc9ceb2727 (diff)
downloadayatana-indicator-sound-0517b25ec28abbd239009887edbae1684995c560.tar.gz
ayatana-indicator-sound-0517b25ec28abbd239009887edbae1684995c560.tar.bz2
ayatana-indicator-sound-0517b25ec28abbd239009887edbae1684995c560.zip
Protect against icon serialization errors Fixes: 1305902
Diffstat (limited to 'src')
-rw-r--r--src/accounts-service-user.vala14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index 4dd7e6f..04c38cc 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -58,13 +58,19 @@ public class AccountsServiceUser : Object {
} else {
this.proxy.timestamp = GLib.get_monotonic_time();
this.proxy.player_name = this._player.name;
- if (this._player.icon == null) {
+
+ /* Serialize the icon if it exits, if it doesn't or errors then
+ we need to use the application default icon */
+ GLib.Variant? icon_serialization = null;
+ if (this._player.icon != null)
+ icon_serialization = this._player.icon.serialize();
+ if (icon_serialization == null) {
var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
- this.proxy.player_icon = icon.serialize();
- } else {
- this.proxy.player_icon = this._player.icon.serialize();
+ icon_serialization = icon.serialize();
}
+ this.proxy.player_icon = icon_serialization;
+ /* Set state of the player */
this.proxy.running = this._player.is_running;
this.proxy.state = this._player.state;