eina_list: Avoid NULL pointer deref in eina_list_shuffle.

If we have a valid but empty, n = 0, list we never enter the loop
and shuffled_last might still be NULL. Avoid this case by checking
explicitly for n = 0 before.
This commit is contained in:
Stefan Schmidt 2013-06-25 15:18:33 +01:00
parent 8deb75463b
commit 9c1ed31c76
1 changed files with 3 additions and 0 deletions

View File

@ -1111,6 +1111,9 @@ eina_list_shuffle(Eina_List *list, Eina_Random_Cb func)
n = accounting->count;
shuffled_list = shuffled_last = NULL;
if (n == 0)
return NULL;
if (n == 1)
return list;