mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Avoid an unnecessary unwrap() call in handle_take_screenshot.
This commit is contained in:
parent
1f45a736e5
commit
2e16c3ca8a
1 changed files with 6 additions and 5 deletions
|
@ -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"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue