diff options
author | Robert Tari <robert@tari.in> | 2021-08-24 21:37:58 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-28 13:04:38 +0200 |
commit | 0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7 (patch) | |
tree | 1db8314a07059d8516e798c37b38ff66835f3486 /src | |
parent | 405fe08f36576c8d4461026994e8b2ac9cd80746 (diff) | |
download | ayatana-indicator-sound-0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7.tar.gz ayatana-indicator-sound-0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7.tar.bz2 ayatana-indicator-sound-0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7.zip |
Fix possible null access
Diffstat (limited to 'src')
-rw-r--r-- | src/accounts-service-user.vala | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala index fee5fe9..e7e2299 100644 --- a/src/accounts-service-user.vala +++ b/src/accounts-service-user.vala @@ -193,14 +193,18 @@ public class AccountsServiceUser : Object { void new_privacy_proxy (GLib.Object? obj, AsyncResult res) { try { this.privacyproxy = Bus.get_proxy.end (res); - - (this.privacyproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => { - var welcomeval = changed.lookup_value("MessagesWelcomeScreen", VariantType.BOOLEAN); - if (welcomeval != null) { - debug("Messages on welcome screen changed"); - this.showDataOnGreeter = welcomeval.get_boolean(); - } - }); + var pDBusProxy = this.privacyproxy as DBusProxy; + + if (pDBusProxy != null) + { + pDBusProxy.g_properties_changed.connect((proxy, changed, invalid) => { + var welcomeval = changed.lookup_value("MessagesWelcomeScreen", VariantType.BOOLEAN); + if (welcomeval != null) { + debug("Messages on welcome screen changed"); + this.showDataOnGreeter = welcomeval.get_boolean(); + } + }); + } this.showDataOnGreeter = this.privacyproxy.messages_welcome_screen; } catch (Error e) { @@ -214,15 +218,19 @@ public class AccountsServiceUser : Object { void new_system_sound_proxy (GLib.Object? obj, AsyncResult res) { try { this.syssoundproxy = Bus.get_proxy.end (res); - - (this.syssoundproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => { - var silentvar = changed.lookup_value("SilentMode", VariantType.BOOLEAN); - if (silentvar != null) { - debug("Silent Mode changed"); - this._silentMode = silentvar.get_boolean(); - this.notify_property("silentMode"); - } - }); + var pDBusProxy = this.syssoundproxy as DBusProxy; + + if (pDBusProxy != null) + { + pDBusProxy.g_properties_changed.connect((proxy, changed, invalid) => { + var silentvar = changed.lookup_value("SilentMode", VariantType.BOOLEAN); + if (silentvar != null) { + debug("Silent Mode changed"); + this._silentMode = silentvar.get_boolean(); + this.notify_property("silentMode"); + } + }); + } this._silentMode = this.syssoundproxy.silent_mode; this.notify_property("silentMode"); |