'switch' now handles empty case correctly
This commit is contained in:
parent
a9a73314af
commit
8ad16ad825
1 changed files with 1 additions and 1 deletions
|
@ -33,7 +33,7 @@ pub fn switch(state: &mut State) {
|
||||||
//TODO: -d flag handling needs to be done manually
|
//TODO: -d flag handling needs to be done manually
|
||||||
|
|
||||||
let args = state.args.clone().finish();
|
let args = state.args.clone().finish();
|
||||||
let target: String = match args.get(0).map(|s| s.to_str().unwrap()) {
|
let target: String = match if let Some(inner) = args.get(0) { inner.to_str() } else { None } {
|
||||||
None |
|
None |
|
||||||
Some("-") => if let Some(prev) = message(MSG_PREVIOUS) { prev }
|
Some("-") => if let Some(prev) = message(MSG_PREVIOUS) { prev }
|
||||||
else { error::missing_target(); panic!() },
|
else { error::missing_target(); panic!() },
|
||||||
|
|
Loading…
Reference in a new issue