altoslib: Always create an ordered record set for eeprom files
authorKeith Packard <keithp@keithp.com>
Tue, 18 Jun 2019 21:25:09 +0000 (14:25 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 18 Jun 2019 21:25:09 +0000 (14:25 -0700)
If we can't parse the format, just leave it empty. This makes code
handling arbitrary records much easier as it doesn't have to check for
the ordered set existing.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosEepromRecordSet.java

index e26a1e0..aec302e 100644 (file)
@@ -91,11 +91,12 @@ public class AltosEepromRecordSet implements AltosRecordSet {
                        break;
                }
 
+               ordered = new TreeSet<AltosEepromRecord>();
+
                if (record == null) {
                        System.out.printf("failed to parse log format %d\n", config_data.log_format);
                        return;
                }
-               ordered = new TreeSet<AltosEepromRecord>();
                int     tick = 0;
                boolean first = true;