state: avoid walking off empty list

When removing the last key in a list, the last part of the for statement
could cause dereferencing (NULL)->next and thus segfaulting.
This commit is contained in:
Øyvind Kolås 2010-06-16 17:44:06 +01:00
parent 35c6179a8e
commit 351b6c0543

View File

@ -273,7 +273,7 @@ clutter_state_remove_key_internal (ClutterState *this,
{
GList *k;
for (k = target_state->keys; k; k = k->next)
for (k = target_state->keys; k != NULL; k = k?k->next:NULL)
{
ClutterStateKey *key = k->data;