diff options
author | cee1 <fykcee1@gmail.com> | 2011-06-18 10:11:47 +0800 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2011-06-28 23:59:26 -0400 |
commit | cff3164a23ddb7be1bd27b743ec58b14f83749c9 (patch) | |
tree | 724dd4f74bba0cc8d73e7f3ad2914b49bd159a03 | |
parent | 71f6221f8dbe4e263e8f1863fff016c70fe32515 (diff) |
progress-animation: allow 0 frame animations
Currently ply-progress-animation crashes if you try to pass it
an animation with 0 available frames.
This commit makes it silently succeed.
-rw-r--r-- | src/libply-splash-graphics/ply-progress-animation.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libply-splash-graphics/ply-progress-animation.c b/src/libply-splash-graphics/ply-progress-animation.c index 00569ecf..2605f6d2 100644 --- a/src/libply-splash-graphics/ply-progress-animation.c +++ b/src/libply-splash-graphics/ply-progress-animation.c @@ -368,14 +368,15 @@ ply_progress_animation_add_frames (ply_progress_animation_t *progress_animation) && strcmp (entries[i]->d_name + strlen (entries[i]->d_name) - 4, ".png") == 0) { char *filename; + bool r; filename = NULL; asprintf (&filename, "%s/%s", progress_animation->image_dir, entries[i]->d_name); - if (!ply_progress_animation_add_frame (progress_animation, filename)) - goto out; - + r = ply_progress_animation_add_frame (progress_animation, filename); free (filename); + if (!r) + goto out; } free (entries[i]); @@ -399,7 +400,7 @@ out: { ply_progress_animation_remove_frames (progress_animation); - while (entries[i] != NULL) + while (i < number_of_entries) { free (entries[i]); i++; |