mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #7170 - Ms2ger:unwrap-constellation, r=jdm
Avoid unwrap calls in handle_navigate_msg. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7170) <!-- Reviewable:end -->
This commit is contained in:
commit
54300a9c73
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 {
|
||||
NavigationDirection::Forward => {
|
||||
if frame.next.is_empty() {
|
||||
debug!("no next page to navigate to");
|
||||
return;
|
||||
match frame.next.pop() {
|
||||
None => {
|
||||
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 => {
|
||||
if frame.prev.is_empty() {
|
||||
debug!("no previous page to navigate to");
|
||||
return;
|
||||
match frame.prev.pop() {
|
||||
None => {
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue