altosui: Close serial port when debug link fails
authorKeith Packard <keithp@keithp.com>
Mon, 22 Nov 2010 23:53:27 +0000 (15:53 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 22 Nov 2010 23:53:27 +0000 (15:53 -0800)
If the debug connection isn't working, close down the serial port when
reporting the failure.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/AltosFlash.java

index fa2465d337748a0af7ee0fd79dcdd0c80d5e8552..3af25c23457b696529ea8a2eb19fc1a8bb06278a 100644 (file)
@@ -336,7 +336,9 @@ public class AltosFlash {
                debug = new AltosDebug(in_debug_dongle);
                input = new FileInputStream(file);
                image = new AltosHexfile(input);
-               if (!debug.check_connection())
+               if (!debug.check_connection()) {
+                       debug.close();
                        throw new IOException("Debug port not connected");
+               }
        }
 }
\ No newline at end of file