altosui: check for closed serial device before reading
[fw/altos] / ao-tools / altosui / AltosSerial.java
index f12b31b3187e9b253b4a3560080db9d8e2966d7e..96e8b61f599d2329678dbe547b3edc3eb3389f11 100644 (file)
@@ -51,6 +51,8 @@ public class AltosSerial implements Runnable {
 
                try {
                        for (;;) {
+                               if (altos == null)
+                                       break;
                                c = libaltos.altos_getchar(altos, 0);
                                if (Thread.interrupted())
                                        break;
@@ -139,7 +141,7 @@ public class AltosSerial implements Runnable {
                        throw new FileNotFoundException(device.getPath());
                input_thread = new Thread(this);
                input_thread.start();
-               print("\nE 0\nm 1\n");
+               print("\nE 0\n");
                try {
                        Thread.sleep(200);
                } catch (InterruptedException e) {