Skip to content

Commit

Permalink
fix: handle case where args len is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianvp committed Dec 6, 2024
1 parent 79ed6f8 commit e2b4794
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions zingolib/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ impl Command for ChangeServerCommand {

fn exec(&self, args: &[&str], lightclient: &LightClient) -> String {
match args.len() {
0 => {
lightclient.set_server(http::Uri::default());
"server set".to_string()
}
1 => match http::Uri::from_str(args[0]) {
Ok(uri) => {
lightclient.set_server(uri);
Expand Down

0 comments on commit e2b4794

Please sign in to comment.