Avoid an unnecessary unwrap() call in handle_take_screenshot.

This commit is contained in:
Ms2ger 2015-10-06 18:10:48 +02:00
parent 1f45a736e5
commit 2e16c3ca8a

View file

@ -615,12 +615,13 @@ impl Handler {
sleep_ms(interval)
}
if img.is_none() {
return Err(WebDriverError::new(ErrorStatus::Timeout,
"Taking screenshot timed out"));
}
let mut img = match img {
Some(img) => img,
None => return Err(WebDriverError::new(ErrorStatus::Timeout,
"Taking screenshot timed out")),
};
let img_vec = match png::to_vec(&mut img.unwrap()) {
let img_vec = match png::to_vec(&mut img) {
Ok(x) => x,
Err(_) => return Err(WebDriverError::new(ErrorStatus::UnknownError,
"Taking screenshot failed"))