mirror of
https://github.com/servo/servo
synced 2026-05-05 06:32:13 +02:00
Avoid an unnecessary unwrap() call in handle_take_screenshot.
This commit is contained in:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user