diff --git a/src/parse/value/css_function.rs b/src/parse/value/css_function.rs index b900685..c20b0c3 100644 --- a/src/parse/value/css_function.rs +++ b/src/parse/value/css_function.rs @@ -64,7 +64,12 @@ impl<'a> Parser<'a> { pub(super) fn parse_progid(&mut self) -> SassResult { let mut string = String::new(); - let mut span = self.toks.peek().unwrap().pos(); + let mut span = match self.toks.peek() { + Some(token) => token.pos(), + None => { + return Err(("expected \"(\".", self.span_before).into()); + } + }; while let Some(tok) = self.toks.next() { span = span.merge(tok.pos()); match tok.kind { diff --git a/tests/special-functions.rs b/tests/special-functions.rs index b3ed40b..6db0887 100644 --- a/tests/special-functions.rs +++ b/tests/special-functions.rs @@ -202,3 +202,7 @@ test!( "a {\n color: PrOgId:foo(fff);\n}\n", "a {\n color: progid:foo(fff);\n}\n" ); +error!( + progid_nothing_after, + "a { color: progid:", "Error: expected \"(\"." +);