Switch from GPLv2 to GPLv2+
[fw/altos] / altosui / AltosConfigTD.java
index 4389e49b0c57ac431512a5544b3243441390afa0..13eced99dea325a40b366911f8bb05115095783a 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,8 +22,8 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.altoslib_5.*;
-import org.altusmetrum.altosuilib_3.*;
+import org.altusmetrum.altoslib_11.*;
+import org.altusmetrum.altosuilib_11.*;
 
 public class AltosConfigTD implements ActionListener {
 
@@ -223,8 +224,10 @@ public class AltosConfigTD implements ActionListener {
                                        if (!config_version.get().equals("0.0"))
                                                break;
                                        been_there = true;
-                                       config.serial_line.printf("C\n ");
-                                       config.serial_line.flush_input();
+                                       if (config != null && config.serial_line != null) {
+                                               config.serial_line.printf("C\n ");
+                                               config.serial_line.flush_input();
+                                       }
                                }
                        } catch (InterruptedException ie) {
                        }
@@ -277,8 +280,10 @@ public class AltosConfigTD 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()),