aboutsummaryrefslogtreecommitdiff
path: root/src/volume-control.vala
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-12-06 11:10:51 -0600
committerTed Gould <ted@gould.cx>2014-12-06 11:10:51 -0600
commit90c987b1683219a68f54c70fe4d58e4482df7df3 (patch)
tree1c2f7aaf613ff1598809c6d7236fa4b6184dc630 /src/volume-control.vala
parent2f0aba374502b7ea660fce49f70e3ea972725685 (diff)
downloadayatana-indicator-sound-90c987b1683219a68f54c70fe4d58e4482df7df3.tar.gz
ayatana-indicator-sound-90c987b1683219a68f54c70fe4d58e4482df7df3.tar.bz2
ayatana-indicator-sound-90c987b1683219a68f54c70fe4d58e4482df7df3.zip
Ensure that the active port is not null before looking at its value
Diffstat (limited to 'src/volume-control.vala')
-rw-r--r--src/volume-control.vala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/volume-control.vala b/src/volume-control.vala
index 6f22dc5..3b175e5 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -185,9 +185,10 @@ public class VolumeControl : Object
* checking for the port name. On touch (with the pulseaudio droid element)
* the headset/headphone port is called 'output-headset' and 'output-headphone'.
* On the desktop this is usually called 'analog-output-headphones' */
- if (i.active_port.name == "output-wired_headset" ||
- i.active_port.name == "output-wired_headphone" ||
- i.active_port.name == "analog-output-headphones") {
+ if (i.active_port != null &&
+ (i.active_port.name == "output-wired_headset" ||
+ i.active_port.name == "output-wired_headphone" ||
+ i.active_port.name == "analog-output-headphones")) {
_active_port_headphone = true;
} else {
_active_port_headphone = false;