From 64e4f67e43493dc0832600dc84931aee8b28105d Mon Sep 17 00:00:00 2001 From: mordquist <16607572+mordquist@users.noreply.github.com> Date: Sun, 26 May 2024 00:53:52 +0200 Subject: [PATCH] Add error for missing username on `:logout` (#277) --- src/commands.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands.rs b/src/commands.rs index 6781f1b..81fe031 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -515,6 +515,9 @@ fn iamb_open(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult { fn iamb_logout(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult { let args = desc.arg.strings()?; + if args.is_empty() { + return Result::Err(CommandError::Error("Missing username".to_string())); + } if args.len() != 1 { return Result::Err(CommandError::InvalidArgument); }