diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 950f3f120..f12ad9d6a 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -132,7 +132,10 @@ impl OptionParser { } pub fn get(&self, option: &str) -> Option { - self.options.get(option).and_then(|v| v.value.clone()) + self.options + .get(option) + .and_then(|v| v.value.clone()) + .and_then(|s| if s.is_empty() { None } else { Some(s) }) } pub fn is_set(&self, option: &str) -> bool { @@ -143,7 +146,7 @@ impl OptionParser { } pub fn convert(&self, option: &str) -> OptionParserResult> { - match self.options.get(option).and_then(|v| v.value.as_ref()) { + match self.get(option) { None => Ok(None), Some(v) => Ok(Some(v.parse().map_err(|_| { OptionParserError::Conversion(option.to_owned(), v.to_owned())