servo: Merge #12008 - Reorder code in KeyframesAnimation::from_keyframes() to avoid a panic (from servo:keyframes); r=Manishearth
authorMs2ger <Ms2ger@gmail.com>
Fri, 01 Jul 2016 07:58:50 -0700
changeset 339177 fe4eb784daa3a3a6fcf7f913f23482f708352ff5
parent 339176 3c2252eb0ffb2f58464a69e925131d9fe6ebd461
child 339178 ba9bcef6e4728b847967193994ecc5d85d1edfeb
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersManishearth
servo: Merge #12008 - Reorder code in KeyframesAnimation::from_keyframes() to avoid a panic (from servo:keyframes); r=Manishearth Fixes #11999. Fixes #12006. Source-Repo: https://github.com/servo/servo Source-Revision: b2a32ec028156170e63a07c072120db89923e6af
servo/components/style/keyframes.rs
--- a/servo/components/style/keyframes.rs
+++ b/servo/components/style/keyframes.rs
@@ -149,18 +149,22 @@ fn get_animated_properties(keyframe: &Ke
         }
     }
 
     ret
 }
 
 impl KeyframesAnimation {
     pub fn from_keyframes(keyframes: &[Keyframe]) -> Option<Self> {
+        if keyframes.is_empty() {
+            return None;
+        }
+
         let animated_properties = get_animated_properties(&keyframes[0]);
-        if keyframes.is_empty() || animated_properties.is_empty() {
+        if animated_properties.is_empty() {
             return None;
         }
 
         let mut steps = vec![];
 
         for keyframe in keyframes {
             for percentage in keyframe.selector.0.iter() {
                 steps.push(KeyframesStep::new(*percentage,