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 e04d679..28a7550 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();
        }