Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
[fw/altos] / 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