X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosBluetooth.java;h=359b58321ed11995d805cc5a583aa539fd9d890c;hb=a61217f0a6d0ef48b6471f632c4600255867e831;hp=baf38fb71aa854a24a24a30abac96c3eddd61182;hpb=7041c386cdf37716f8daf0bc1a9204db620e3de9;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java index baf38fb7..359b5832 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java @@ -4,7 +4,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -30,7 +31,7 @@ import android.bluetooth.BluetoothSocket; import android.os.Handler; //import android.os.Message; -import org.altusmetrum.altoslib_9.*; +import org.altusmetrum.altoslib_12.*; public class AltosBluetooth extends AltosDroidLink { @@ -199,6 +200,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 +211,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) {