diff options
author | Daniel Friesel <derf@finalrewind.org> | 2010-11-30 18:45:44 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2010-11-30 18:45:44 +0100 |
commit | 9b5fac879c86ee35cb23ccf9b4e0b448fafbf69a (patch) | |
tree | 4040bca54be752b4d6b4658bdb5e51cb1ff46b74 /src | |
parent | 8072333833f0efe0d914853a55527a670bc7f0ca (diff) |
slideshow.c: Fix segfault after encountering multiple invalid images in a row
Diffstat (limited to 'src')
-rw-r--r-- | src/slideshow.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/slideshow.c b/src/slideshow.c index 19ab6a6..de10300 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -177,6 +177,10 @@ void slideshow_change_image(winwidget winwid, int change) gib_list *last = NULL; int i = 0; int jmp = 1; + /* We can't use filelist_len in the for loop, since that changes when we + * encounter invalid images. + */ + int our_filelist_len = filelist_len; char *s; /* Without this, clicking a one-image slideshow reloads it. Not very * @@ -197,7 +201,7 @@ void slideshow_change_image(winwidget winwid, int change) } /* The for loop prevents us looping infinitely */ - for (i = 0; i < filelist_len; i++) { + for (i = 0; i < our_filelist_len; i++) { winwidget_free_image(winwid); switch (change) { case SLIDE_NEXT: |