Skip to content

Commit 49b26bb

Browse files
sbeckerivStranger6667
authored andcommitted
use unwrap_or_else and skip empty
1 parent cf6ecaa commit 49b26bb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,18 @@ impl<'a> CSSInliner<'a> {
294294
.borrow()
295295
.get("href")
296296
.as_ref()
297-
.unwrap()
297+
.unwrap_or_else(|| &"")
298298
.to_string()
299-
300299
})
301300
.collect::<Vec<String>>();
302301
links.sort();
303302
links.dedup();
304303
for href in &links {
305-
let url = self.get_full_url(href);
306-
let css = self.load_external(url.as_ref())?;
307-
process_css(&document, css.as_str())?;
304+
if !href.is_empty() {
305+
let url = self.get_full_url(href);
306+
let css = self.load_external(url.as_ref())?;
307+
process_css(&document, css.as_str())?;
308+
}
308309
}
309310
}
310311
if let Some(extra_css) = &self.options.extra_css {

0 commit comments

Comments
 (0)