animator: handle no initial key

Fixing the crasher reported in bug #1995.
This commit is contained in:
Øyvind Kolås 2010-02-25 12:30:07 +00:00
parent d2db512788
commit 3bc0672fef

View File

@ -457,8 +457,9 @@ animation_animator_ensure_animator (ClutterAnimator *animator,
initial = g_list_find_custom (key_animator->current->next,
key,
sort_actor_prop_func);
g_assert (initial != NULL);
if (initial)
{
initial_key = initial->data;
clutter_interval_set_initial_value (key_animator->interval,
@ -488,6 +489,16 @@ animation_animator_ensure_animator (ClutterAnimator *animator,
if ((clutter_alpha_get_mode (key_animator->alpha) != next_key->mode))
clutter_alpha_set_mode (key_animator->alpha, next_key->mode);
}
else /* no relevant interval */
{
ClutterAnimatorKey *current_key = key_animator->current->data;
clutter_interval_set_initial_value (key_animator->interval,
&current_key->value);
clutter_interval_set_final_value (key_animator->interval,
&current_key->value);
break;
}
}
}
else if (progress < key_animator->start)
{
@ -500,8 +511,9 @@ animation_animator_ensure_animator (ClutterAnimator *animator,
initial = list_find_custom_reverse (key_animator->current->prev,
key,
sort_actor_prop_func);
g_assert (initial != NULL);
if (initial)
{
initial_key = initial->data;
clutter_interval_set_initial_value (key_animator->interval,
@ -528,6 +540,16 @@ animation_animator_ensure_animator (ClutterAnimator *animator,
if ((clutter_alpha_get_mode (key_animator->alpha) != next_key->mode))
clutter_alpha_set_mode (key_animator->alpha, next_key->mode);
}
else /* no relevant interval */
{
ClutterAnimatorKey *current_key = key_animator->current->data;
clutter_interval_set_initial_value (key_animator->interval,
&current_key->value);
clutter_interval_set_final_value (key_animator->interval,
&current_key->value);
break;
}
}
}
}