guelfey / go.dbus

Native Go bindings for D-Bus
BSD 2-Clause "Simplified" License
124 stars 42 forks source link

Handle signals with omitted sender #22

Closed tdubrownik closed 11 years ago

tdubrownik commented 11 years ago

As per http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages , a DBus signal may not have a Sender header field. As that makes msg.Headers[FieldSender] a Variant that cannot be converted to string, runtime panics ensue.

A real-life example of a service that issues such signals is PulseAudio.

I added a failsafe for this, which ensures an empty string Sender value for signals that do not have an explicit Sender header.

guelfey commented 11 years ago

Nice catch. I simplified the code a bit after merging.