Skip to content

Commit

Permalink
Addresses bboozzoo#53
Browse files Browse the repository at this point in the history
This prevents the server from crashing when the mpris plugin tries to talk to devices that aren't (yet) connected.
  • Loading branch information
xxxserxxx committed Jun 7, 2021
1 parent 9b7319c commit 36d52c5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/mconnect/devicechannel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,16 @@ class DeviceChannel : Object {
string to_send = pkt.to_string () + "\n";
debug ("send data: %s", to_send);

GLib.assert (this._dout != null);

try {
this._dout.put_string (to_send);
} catch (IOError e) {
warning ("failed to send message: %s", e.message);
// TODO disconnect?
}
if (this._dout != null) {
try {
this._dout.put_string (to_send);
} catch (IOError e) {
warning ("failed to send message: %s", e.message);
// TODO disconnect?
}
} else {
warning ("not connected to: %s", this._isa.address.to_string ());
}
}

/**
Expand Down

0 comments on commit 36d52c5

Please sign in to comment.