Skip to content

Commit

Permalink
fix: ::get_costs panicking
Browse files Browse the repository at this point in the history
  • Loading branch information
csgui committed Dec 26, 2022
1 parent e41ae71 commit 822d8e2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/clarity-repl/src/repl/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,14 @@ impl Session {
}

pub fn get_costs(&mut self, output: &mut Vec<String>, cmd: &str) {
let snippet = cmd.to_string().split_off("::get_costs ".len());
self.run_snippet(output, true, &snippet.to_string());
let command: String = cmd.to_owned();
let v: Vec<&str> = command.split_whitespace().collect();

if v.len() != 2 {
output.push(red!(format!("::get_costs command needs an argument")));
} else {
self.run_snippet(output, true, &v[1].to_string());
}
}

#[cfg(feature = "cli")]
Expand Down

0 comments on commit 822d8e2

Please sign in to comment.