Skip to content

Commit

Permalink
fix: fix panics in custom_at_rule example (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix-ru authored Apr 28, 2023
1 parent 6e5d714 commit df493d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/custom_at_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fn main() {
let source = std::fs::read_to_string(&args[1]).unwrap();
let opts = ParserOptions {
filename: args[1].clone(),
nesting: true,
..Default::default()
};

Expand Down Expand Up @@ -191,7 +192,9 @@ impl<'a, 'i> Visitor<'i, AtRule> for ApplyVisitor<'a, 'i> {
if let CssRule::Custom(AtRule::Apply(apply)) = rule {
let mut declarations = DeclarationBlock::new();
for name in &apply.names {
let applied = self.rules.get(name).unwrap();
let Some(applied) = self.rules.get(name) else {
continue;
};
declarations
.important_declarations
.extend(applied.important_declarations.iter().cloned());
Expand Down

0 comments on commit df493d3

Please sign in to comment.