aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/client/stats.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/command/client/stats.rs b/src/command/client/stats.rs
index b6634233..45bc3571 100644
--- a/src/command/client/stats.rs
+++ b/src/command/client/stats.rs
@@ -26,9 +26,13 @@ pub struct Cmd {
fn compute_stats(history: &[History], count: usize) -> Result<()> {
let mut commands = HashMap::<&str, usize>::new();
for i in history {
- *commands
- .entry(i.command.split_ascii_whitespace().next().unwrap())
- .or_default() += 1;
+ let command = i.command.split_ascii_whitespace().next();
+
+ if command.is_none() {
+ continue;
+ }
+
+ *commands.entry(command.unwrap()).or_default() += 1;
}
let unique = commands.len();
let mut top = commands.into_iter().collect::<Vec<_>>();