From b440258027831d70369074c4317d39f4a64f2b40 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Thu, 2 Apr 2020 02:32:32 -0400 Subject: [PATCH] handle no value after / --- src/value/parse.rs | 3 +++ tests/error.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/value/parse.rs b/src/value/parse.rs index 94c955a..307b0be 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -599,6 +599,9 @@ impl Value { } '/' => { toks.next(); + if toks.peek().is_none() { + return Err("Expected expression.".into()); + } if '*' == toks.peek().unwrap().kind { toks.next(); eat_comment(toks, &Scope::new(), &Selector::new())?; diff --git a/tests/error.rs b/tests/error.rs index 3c052c5..969c45a 100644 --- a/tests/error.rs +++ b/tests/error.rs @@ -53,3 +53,7 @@ error!( "a{l {color: foo;}}", "Error: expected selector." ); error!(backtick_in_selector, "a`{}", "Error: expected selector."); +error!( + no_value_after_forward_slash, + "a {color: 303/;}", "Error: Expected expression." +);