summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-09-01 18:23:42 -0500
committerKeith Packard <keithp@keithp.com>2014-09-01 18:23:42 -0500
commit7735cee871d02215517cb9d91cd552f003ca6a50 (patch)
tree519ebba9145eeae614fa18b224e89aef4e452f0a
parent57f0ae384f3c206ea777dc7c93b594ae3901f354 (diff)
altoslib: Catch a couple null pointers in AltosConfigTD
When messing with TD, I hit a couple of paths that could try to dereference null pointers. Check for those. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosConfigTD.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java
index 4389e49b..9020ed9d 100644
--- a/altosui/AltosConfigTD.java
+++ b/altosui/AltosConfigTD.java
@@ -223,8 +223,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 +279,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()),