aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-08-24 21:37:58 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-28 13:04:38 +0200
commit0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7 (patch)
tree1db8314a07059d8516e798c37b38ff66835f3486
parent405fe08f36576c8d4461026994e8b2ac9cd80746 (diff)
downloadayatana-indicator-sound-0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7.tar.gz
ayatana-indicator-sound-0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7.tar.bz2
ayatana-indicator-sound-0ff285734a6744a7ca55f1fc7ddf53d9c603f5c7.zip
Fix possible null access
-rw-r--r--src/accounts-service-user.vala42
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");