altosui: check for closed serial device before reading
authorKeith Packard <keithp@keithp.com>
Thu, 29 Jul 2010 17:24:09 +0000 (10:24 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 29 Jul 2010 17:24:09 +0000 (10:24 -0700)
Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/AltosSerial.java

index a5566ab898d4f3eb096f2d131e925e585bf8a499..96e8b61f599d2329678dbe547b3edc3eb3389f11 100644 (file)
@@ -51,6 +51,8 @@ public class AltosSerial implements Runnable {
 
                try {
                        for (;;) {
 
                try {
                        for (;;) {
+                               if (altos == null)
+                                       break;
                                c = libaltos.altos_getchar(altos, 0);
                                if (Thread.interrupted())
                                        break;
                                c = libaltos.altos_getchar(altos, 0);
                                if (Thread.interrupted())
                                        break;