diff --git a/src/tui/mod.rs b/src/tui/mod.rs index 36144a5..2734fbc 100644 --- a/src/tui/mod.rs +++ b/src/tui/mod.rs @@ -40,20 +40,25 @@ async fn print_info(arc_data: &Arc>, min_len_series: &mut u32 println!("{:#<1$}", "", separator_width); let mut sorted_series: Vec<(&String, &PostHistory)> = data.post_history.series.iter().collect(); sorted_series.sort_by(|(a, _), (b, _)| a.cmp(b)); - sorted_series.iter().for_each(|(series, post_history)| { + for (series, post_history) in sorted_series.iter() { if series.len() > local_min_len_series { local_min_len_series = series.len() + 1; *min_len_series = local_min_len_series as u32; } - let series_config = data.config.series + let series_config = match data.config.series .iter() - .find(|ser| {&&ser.slug == series}) - .expect("Config should not parse without this"); + .find(|ser| { + &&ser.slug == series + }) { + Some(data) => data, + None => continue, + }; + let mut sorted_parts: Vec<(&String, &PostHistoryInner)> = post_history.parts.iter().collect(); sorted_parts.sort_by(|(a, _), (b, _)| a.cmp(b)); - sorted_parts.iter().for_each(|(part, part_history)| { + for (part, part_history) in sorted_parts.iter() { if part_history.volume.len() > local_min_len_slug { local_min_len_slug = part_history.chapter.len() + 1; @@ -82,8 +87,8 @@ async fn print_info(arc_data: &Arc>, min_len_series: &mut u32 print!("{:<1$}| ", "", local_min_len_slug - part_history.chapter.len()); print!("{}", series_config.prepub_community.name); println!("{:<1$}|", "", 20 - series_config.prepub_community.name.len()); - }); - }); + } + } println!("{:#<1$}", "", separator_width); for error in data.get_messages(true, true, false).iter() { println!("{}", error.content());