diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-28 13:27:25 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-28 13:27:25 +0200 |
commit | c33bfccdc08bea14595094c00bc48edb357edfa5 (patch) | |
tree | 1db8314a07059d8516e798c37b38ff66835f3486 | |
parent | 405fe08f36576c8d4461026994e8b2ac9cd80746 (diff) | |
parent | 0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7 (diff) | |
download | ayatana-indicator-sound-c33bfccdc08bea14595094c00bc48edb357edfa5.tar.gz ayatana-indicator-sound-c33bfccdc08bea14595094c00bc48edb357edfa5.tar.bz2 ayatana-indicator-sound-c33bfccdc08bea14595094c00bc48edb357edfa5.zip |
Merge branch 'tari01-pr/fix-possible-null-access'
Attributes GH PR #30: https://github.com/AyatanaIndicators/ayatana-indicator-sound/pull/30
-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"); |