altosui: Catch errors opening USB devices. Limit list to relevant devices
[fw/altos] / ao-tools / altosui / AltosSerial.java
index e84f5b63e4e21c7ca5cdd0cbb0cb90c863383ced..b016c1d65fbecfe0463c0e97933148cf10c2d55b 100644 (file)
@@ -134,6 +134,8 @@ public class AltosSerial implements Runnable {
        public void open(altos_device device) throws FileNotFoundException {
                close();
                altos = libaltos.altos_open(device);
+               if (altos == null)
+                       throw new FileNotFoundException(device.getPath());
                input_thread = new Thread(this);
                input_thread.start();
        }