aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-03-09 00:32:56 +0100
committerRobert Tari <robert@tari.in>2021-08-04 21:42:10 +0200
commit8df9168f5587cfd31e0bf6a4170a4c4f9784dbb7 (patch)
tree79a6b0b0a2b87e94bb7c727bb9a3a0cde2ad3a29 /src
parent6bf50a40c9dc25ae33878d246a74ffc5106dd4a5 (diff)
downloadayatana-indicator-sound-8df9168f5587cfd31e0bf6a4170a4c4f9784dbb7.tar.gz
ayatana-indicator-sound-8df9168f5587cfd31e0bf6a4170a4c4f9784dbb7.tar.bz2
ayatana-indicator-sound-8df9168f5587cfd31e0bf6a4170a4c4f9784dbb7.zip
Avoid possible null value
Diffstat (limited to 'src')
-rw-r--r--src/media-player-list-greeter.vala9
-rw-r--r--src/media-player-user.vala21
2 files changed, 25 insertions, 5 deletions
diff --git a/src/media-player-list-greeter.vala b/src/media-player-list-greeter.vala
index fb57597..1357e38 100644
--- a/src/media-player-list-greeter.vala
+++ b/src/media-player-list-greeter.vala
@@ -45,8 +45,13 @@ public class MediaPlayerListGreeter : MediaPlayerList {
this.proxy.entry_selected.connect(active_user_changed);
this.proxy.get_active_entry.begin ((obj, res) => {
try {
- var value = (obj as AyatanaGreeterList).get_active_entry.end(res);
- active_user_changed(value);
+ var list = (obj as AyatanaGreeterList);
+
+ if (list != null)
+ {
+ var value = list.get_active_entry.end(res);
+ active_user_changed(value);
+ }
} catch (Error e) {
warning("Unable to get active entry: %s", e.message);
}
diff --git a/src/media-player-user.vala b/src/media-player-user.vala
index 3cc90a0..ee31537 100644
--- a/src/media-player-user.vala
+++ b/src/media-player-user.vala
@@ -238,7 +238,12 @@ public class MediaPlayerUser : MediaPlayer {
if (this.greeter != null) {
this.greeter.RequestSoundPlayPause.begin(this.username, (obj, res) => {
try {
- (obj as GreeterBroadcast).RequestSoundPlayPause.end(res);
+ var broadcasts = (obj as GreeterBroadcast);
+
+ if (broadcasts != null)
+ {
+ broadcasts.RequestSoundPlayPause.end(res);
+ }
} catch (Error e) {
warning("Unable to send play pause: %s", e.message);
}
@@ -253,7 +258,12 @@ public class MediaPlayerUser : MediaPlayer {
if (this.greeter != null) {
this.greeter.RequestSoundNext.begin(this.username, (obj, res) => {
try {
- (obj as GreeterBroadcast).RequestSoundNext.end(res);
+ var broadcasts = (obj as GreeterBroadcast);
+
+ if (broadcasts != null)
+ {
+ broadcasts.RequestSoundNext.end(res);
+ }
} catch (Error e) {
warning("Unable to send next: %s", e.message);
}
@@ -268,7 +278,12 @@ public class MediaPlayerUser : MediaPlayer {
if (this.greeter != null) {
this.greeter.RequestSoundPrev.begin(this.username, (obj, res) => {
try {
- (obj as GreeterBroadcast).RequestSoundPrev.end(res);
+ var broadcasts = (obj as GreeterBroadcast);
+
+ if (broadcasts != null)
+ {
+ broadcasts.RequestSoundPrev.end(res);
+ }
} catch (Error e) {
warning("Unable to send previous: %s", e.message);
}