summaryrefslogtreecommitdiff
path: root/src/slideshow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/slideshow.c')
-rw-r--r--src/slideshow.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/slideshow.c b/src/slideshow.c
index 0f67917..337e202 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -264,8 +264,11 @@ void slideshow_change_image(winwidget winwid, int change, int render)
current_file = feh_list_jump(filelist, current_file, BACK, 1);
break;
case SLIDE_RAND:
- current_file = feh_list_jump(filelist, current_file, FORWARD, rand() % filelist_len);
- change = SLIDE_NEXT;
+ if (filelist_len > 1) {
+ current_file = feh_list_jump(filelist, current_file, FORWARD,
+ (rand() % (filelist_len - 1)) + 1);
+ change = SLIDE_NEXT;
+ }
break;
case SLIDE_JUMP_FWD:
if (filelist_len < 5)