mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 13:38:45 +02:00
[animation] Properly handle zero animation frames
In the event there are no animation frames, we should fail to load the animation control.
This commit is contained in:
parent
e30024211b
commit
3d7f4fe441
1 changed files with 9 additions and 2 deletions
|
|
@ -237,7 +237,7 @@ ply_animation_add_frames (ply_animation_t *animation)
|
|||
|
||||
number_of_entries = scandir (animation->image_dir, &entries, NULL, versionsort);
|
||||
|
||||
if (number_of_entries < 0)
|
||||
if (number_of_entries <= 0)
|
||||
return false;
|
||||
|
||||
load_finished = false;
|
||||
|
|
@ -263,6 +263,13 @@ ply_animation_add_frames (ply_animation_t *animation)
|
|||
free (entries[i]);
|
||||
entries[i] = NULL;
|
||||
}
|
||||
|
||||
if (ply_array_get_size (animation->frames) == 0)
|
||||
{
|
||||
ply_trace ("%s directory had no files starting with %s\n",
|
||||
animation->image_dir, animation->frames_prefix);
|
||||
goto out;
|
||||
}
|
||||
load_finished = true;
|
||||
|
||||
out:
|
||||
|
|
@ -270,7 +277,7 @@ out:
|
|||
{
|
||||
ply_animation_remove_frames (animation);
|
||||
|
||||
while (entries[i] != NULL)
|
||||
while (i < number_of_entries)
|
||||
{
|
||||
free (entries[i]);
|
||||
i++;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue