mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Avoid a panic when clicking a link whose href is unparsable.
This commit is contained in:
parent
ecb6551efa
commit
97c79bbb99
2 changed files with 4 additions and 4 deletions
|
@ -178,7 +178,10 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<DOMString>) {
|
|||
|
||||
// Step 4-5.
|
||||
let document = document_from_node(subject);
|
||||
let url = UrlParser::new().base_url(&document.url()).parse(&href).unwrap();
|
||||
let url = match UrlParser::new().base_url(&document.url()).parse(&href) {
|
||||
Ok(url) => url,
|
||||
Err(_) => return,
|
||||
};
|
||||
|
||||
// Step 7.
|
||||
debug!("following hyperlink to {}", url.serialize());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue