Skip to content

Commit

Permalink
Avoid unwrap calls in handle_navigate_msg.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Aug 12, 2015
1 parent 3b1b3fe commit 1ef1055
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions components/compositing/constellation.rs
Expand Up @@ -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;
Expand Down

0 comments on commit 1ef1055

Please sign in to comment.