From 8da8d520e32d6ca8be071a88cd3702644e07ace4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Mar 2015 10:56:49 -0500 Subject: Handle Vala incorrectly returning null for a non-null type --- src/media-player-mpris.vala | 4 ++-- src/mpris2-interfaces.vala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/media-player-mpris.vala b/src/media-player-mpris.vala index bf25e21..741d887 100644 --- a/src/media-player-mpris.vala +++ b/src/media-player-mpris.vala @@ -202,7 +202,7 @@ public class MediaPlayerMpris: MediaPlayer { gproxy.g_properties_changed.connect (this.proxy_properties_changed); this.notify_property ("is-running"); - this.state = this.proxy.PlaybackStatus; + this.state = this.proxy.PlaybackStatus != null ? this.proxy.PlaybackStatus : "Unknown"; this.update_current_track (gproxy.get_cached_property ("Metadata")); if (this.play_when_attached) { @@ -270,7 +270,7 @@ public class MediaPlayerMpris: MediaPlayer { void proxy_properties_changed (DBusProxy proxy, Variant changed_properties, string[] invalidated_properties) { if (changed_properties.lookup ("PlaybackStatus", "s", null)) { - this.state = this.proxy.PlaybackStatus; + this.state = this.proxy.PlaybackStatus != null ? this.proxy.PlaybackStatus : "Unknown"; } var metadata = changed_properties.lookup_value ("Metadata", new VariantType ("a{sv}")); diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala index cb68e84..a472d5c 100644 --- a/src/mpris2-interfaces.vala +++ b/src/mpris2-interfaces.vala @@ -37,7 +37,7 @@ public interface MprisPlayer : Object { // properties public abstract HashTable Metadata{owned get; set;} public abstract int32 Position{owned get; set;} - public abstract string PlaybackStatus{owned get; set;} + public abstract string? PlaybackStatus{owned get; set;} // methods public abstract async void PlayPause() throws IOError; public abstract async void Next() throws IOError; -- cgit v1.2.3 -- cgit v1.2.3