altosui: Allow AltosConfig to abort before serial line starts
authorKeith Packard <keithp@keithp.com>
Thu, 25 Oct 2012 06:55:45 +0000 (23:55 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 25 Oct 2012 07:07:14 +0000 (00:07 -0700)
Check to see if the serial line is active before trying to close it.

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

index 44c6239af278821f0d229bd29e5d4eb2cdddb17b..4b0edec0fbf5492aa48501c5e9ab2540f121d65c 100644 (file)
@@ -393,8 +393,10 @@ public class AltosConfig implements ActionListener {
        }
 
        void abort() {
-               serial_line.close();
-               serial_line = null;
+               if (serial_line != null) {
+                       serial_line.close();
+                       serial_line = null;
+               }
                JOptionPane.showMessageDialog(owner,
                                              String.format("Connection to \"%s\" failed",
                                                            device.toShortString()),