X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosConfigTD.java;h=13eced99dea325a40b366911f8bb05115095783a;hb=1085ec5d57e0ed5d132f2bbdac1a0b6a32c0ab4a;hp=4389e49b0c57ac431512a5544b3243441390afa0;hpb=95f3a2825377bdb6737446df051c069d58f42d08;p=fw%2Faltos diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index 4389e49b..13eced99 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -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()),