micropeak: Check CRC on downloaded
authorKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 07:10:04 +0000 (23:10 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 07:10:04 +0000 (23:10 -0800)
Signed-off-by: Keith Packard <keithp@keithp.com>
micropeak/MicroDownload.java

index e04d6790f048909385fbaaaae6c17c07e62dabe0..28a7550d1790c309a782205de00f1ed09fc7dd4a 100644 (file)
@@ -37,10 +37,17 @@ public class MicroDownload extends AltosUIDialog implements Runnable, ActionList
        private void done_internal() {
                setVisible(false);
                if (data != null) {
-                       owner = owner.SetData(data);
-                       MicroSave save = new MicroSave(owner, data);
-                       if (save.runDialog())
-                               owner.SetName(data.name);
+                       if (data.crc_valid) {
+                               owner = owner.SetData(data);
+                               MicroSave save = new MicroSave(owner, data);
+                               if (save.runDialog())
+                                       owner.SetName(data.name);
+                       } else {
+                               JOptionPane.showMessageDialog(owner,
+                                                             "Flight data corrupted",
+                                                             "Download Failed",
+                                                             JOptionPane.ERROR_MESSAGE);
+                       }
                }
                dispose();
        }