From 7e6c5c5811c174f89948a7996491e09f931762a5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 14 Sep 2018 01:13:03 +0200 Subject: handle logs which do not have a boss agent --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 85018c8..9d98cc9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -232,9 +232,11 @@ fn search_log(entry: &DirEntry, opt: &Opt) -> Result, RuntimeE /// Extract human-readable information from the given log file. fn extract_info(entry: &DirEntry, log: &Log) -> LogResult { - let boss_name = match log.boss().name() { - AgentName::Single(s) => s, - _ => "", + let bosses = log.boss_agents(); + let boss_name = if bosses.len() == 1 { + unwrap! { AgentName::Single(s) = bosses[0].name() => { s } } + } else { + "" }.into(); let mut players = log -- cgit v1.2.3