forked from enlightenment/efl
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:
parent
8deb75463b
commit
9c1ed31c76
|
@ -1111,6 +1111,9 @@ eina_list_shuffle(Eina_List *list, Eina_Random_Cb func)
|
||||||
n = accounting->count;
|
n = accounting->count;
|
||||||
shuffled_list = shuffled_last = NULL;
|
shuffled_list = shuffled_last = NULL;
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (n == 1)
|
if (n == 1)
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue