Ensure that gradients have at least 2 stops

This commit is contained in:
Manish Goregaokar 2017-01-31 22:23:00 -08:00
parent da89099e26
commit c0e1a1f963

View file

@ -141,6 +141,11 @@ impl Gradient {
_ => { return Err(()); }
};
// https://drafts.csswg.org/css-images/#typedef-color-stop-list
if stops.len() < 2 {
return Err(())
}
Ok(Gradient {
stops: stops,
repeating: repeating,