diff options
author | Keith Packard <keithp@keithp.com> | 2016-05-09 17:57:12 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-05-11 23:22:15 -0700 |
commit | a371253bb5fc25e34d87507dc9b814530f4e28f6 (patch) | |
tree | 2c1379fd1d84bc9fd6984246187710df23b9015a /altosdroid | |
parent | c57d86f6c9b56e90c986f460f93663a3e16cdf7a (diff) |
altosdroid: Check for closed before writing/reading bluetooth
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosdroid')
-rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java index 15efc0e2..51937b7f 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java @@ -199,6 +199,8 @@ public class AltosBluetooth extends AltosDroidLink { } int write(byte[] buffer, int len) { + if (output == null) + return -1; try { output.write(buffer, 0, len); } catch (IOException ie) { @@ -208,6 +210,8 @@ public class AltosBluetooth extends AltosDroidLink { } int read(byte[] buffer, int len) { + if (input == null) + return -1; try { return input.read(buffer, 0, len); } catch (IOException ie) { |