Skip to content

Commit df493d3

Browse files
authored
fix: fix panics in custom_at_rule example (parcel-bundler#476)
1 parent 6e5d714 commit df493d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/custom_at_rule.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fn main() {
2222
let source = std::fs::read_to_string(&args[1]).unwrap();
2323
let opts = ParserOptions {
2424
filename: args[1].clone(),
25+
nesting: true,
2526
..Default::default()
2627
};
2728

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

0 commit comments

Comments
 (0)