animator: avoid walking off empty list
authorØyvind Kolås <pippin@linux.intel.com>
Wed, 16 Jun 2010 16:43:44 +0000 (17:43 +0100)
committerØyvind Kolås <pippin@linux.intel.com>
Wed, 16 Jun 2010 16:45:13 +0000 (17:45 +0100)
When removing the last key in a list, the last part of the for statement
could cause dereferencing (NULL)->next and thus segfaulting.

clutter/clutter-animator.c

index 0c3287a..e81e5dd 100644 (file)
@@ -1407,7 +1407,7 @@ clutter_animator_remove_key_internal (ClutterAnimator *animator,
 
   priv = animator->priv;
 
-  for (k = priv->score; k != NULL; k = k->next)
+  for (k = priv->score; k != NULL; k = k?k->next:NULL)
     {
       ClutterAnimatorKey *key = k->data;