Commit 9b5fac87 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

slideshow.c: Fix segfault after encountering multiple invalid images in a row

parent 80723338
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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: