panic on empty pb_times or gold_times
savage13 opened this issue · comments
Opening an empty msf
file (created from mist-split-tool
) results in:
panicked at index out of bounds: the len is 0 but the index is 0, src/app.rs:353:26
Adding the following before at around src/app.rs:317, sets the length of gold and pb times to be the same length as the splits name.
let n = self.run.splits().len();
let mut v = self.run.gold_times().to_owned();
v.resize_with(n, Default::default);
self.run.set_gold_times(&v);
let mut v = self.run.pb_times().to_owned();
v.resize_with(n, Default::default);
self.run.set_pb_times(&v);
This probably belongs in mist-core instead of the mist app.
Thanks for the report! Adding a sanity check to core's MsfParser
before it returns a parsed run and before it writes a run to fix this. I will say though that currently might be easier just to manually edit the text of the msf files than to use split-tool at this point, because it's pretty bad.