From 7c3dc910740ae90bd6c18f5649e3b8355ac3752b Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Mon, 19 Jan 2015 21:11:01 +0100 Subject: [PATCH] devicechannel: check if streams are non null before calling close() --- src/devicechannel.vala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/devicechannel.vala b/src/devicechannel.vala index 34e6267..8a79a82 100644 --- a/src/devicechannel.vala +++ b/src/devicechannel.vala @@ -99,17 +99,20 @@ class DeviceChannel : Object { } try { - _din.close(); + if (_din != null) + _din.close(); } catch (Error e) { critical("failed to close data input: %s", e.message); } try { - _dout.close(); + if (_dout != null) + _dout.close(); } catch (Error e) { critical("failed to close data output: %s", e.message); } try { - _conn.close(); + if (_conn != null) + _conn.close(); } catch (Error e) { critical("failed to close connection: %s", e.message); }