mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Avoid unwrap calls in handle_navigate_msg.
This commit is contained in:
parent
3b1b3fe0a0
commit
1ef10550b1
1 changed files with 18 additions and 10 deletions
|
@ -798,20 +798,28 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
|
|
||||||
let next = match direction {
|
let next = match direction {
|
||||||
NavigationDirection::Forward => {
|
NavigationDirection::Forward => {
|
||||||
if frame.next.is_empty() {
|
match frame.next.pop() {
|
||||||
debug!("no next page to navigate to");
|
None => {
|
||||||
return;
|
debug!("no next page to navigate to");
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
Some(next) => {
|
||||||
|
frame.prev.push(frame.current);
|
||||||
|
next
|
||||||
|
},
|
||||||
}
|
}
|
||||||
frame.prev.push(frame.current);
|
|
||||||
frame.next.pop().unwrap()
|
|
||||||
}
|
}
|
||||||
NavigationDirection::Back => {
|
NavigationDirection::Back => {
|
||||||
if frame.prev.is_empty() {
|
match frame.prev.pop() {
|
||||||
debug!("no previous page to navigate to");
|
None => {
|
||||||
return;
|
debug!("no previous page to navigate to");
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
Some(prev) => {
|
||||||
|
frame.next.push(frame.current);
|
||||||
|
prev
|
||||||
|
},
|
||||||
}
|
}
|
||||||
frame.next.push(frame.current);
|
|
||||||
frame.prev.pop().unwrap()
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let prev = frame.current;
|
let prev = frame.current;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue