From 46780ceb0d3021a027e600f73d850da9d0f4866b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Mon, 17 Jul 2017 23:14:39 -0700 Subject: [PATCH] Prevent panic during grid-template serialization --- components/style/properties/shorthand/position.mako.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/style/properties/shorthand/position.mako.rs b/components/style/properties/shorthand/position.mako.rs index af4f218ee44..1d4586552c2 100644 --- a/components/style/properties/shorthand/position.mako.rs +++ b/components/style/properties/shorthand/position.mako.rs @@ -374,7 +374,10 @@ Either::First(ref areas) => { let track_list = match *template_rows { GenericGridTemplateComponent::TrackList(ref list) => list, - _ => unreachable!(), // should exist! + // Others template components shouldn't exist with normal shorthand values. + // But if we need to serialize a group of longhand sub-properties for + // the shorthand, we should be able to return empty string instead of crashing. + _ => return Ok(()), }; let mut names_iter = track_list.line_names.iter();