Reorder code in KeyframesAnimation::from_keyframes() to avoid a panic.

Fixes #11999.
Fixes #12006.
This commit is contained in:
Ms2ger 2016-07-01 10:15:38 +02:00
parent 0ae07e07e6
commit 70e964b707
3 changed files with 25 additions and 1 deletions

View file

@ -154,8 +154,12 @@ fn get_animated_properties(keyframe: &Keyframe) -> Vec<TransitionProperty> {
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;
}