Handle null strings in Namespace::new.

This also avoids a string copy in the rare case of an unrecognized namespace.
This commit is contained in:
Ms2ger 2014-09-23 22:22:45 +02:00
parent 4546d5d23c
commit d3d7c1dabd
5 changed files with 21 additions and 24 deletions

View file

@ -40,7 +40,7 @@ pub fn parse_namespace_rule(rule: AtRule, namespaces: &mut NamespaceMap) {
},
URL(value) | String(value) => {
if ns.is_some() { syntax_error!() }
ns = Some(Namespace::from_str(value.as_slice()));
ns = Some(Namespace::from_str(Some(value)));
break
},
_ => syntax_error!(),