Skip to content

Commit

Permalink
image-source: Fix crash when randomize with 0 files
Browse files Browse the repository at this point in the history
  • Loading branch information
flaeri authored and Lain-B committed Feb 3, 2024
1 parent 32ec6c1 commit 0c2f3f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/image-source/obs-slideshow-mk2.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,12 @@ static struct source_data get_new_source(struct slideshow *ss,
static void restart_slides(struct slideshow *ss)
{
struct slideshow_data *ssd = &ss->data;
size_t start_idx = ssd->randomize ? (size_t)rand() % ssd->files.num : 0;
size_t start_idx = 0;

if (ssd->randomize && ssd->files.num > 0) {
start_idx = (size_t)rand() % ssd->files.num;
}

struct active_slides new_slides = {0};

if (ssd->files.num) {
Expand Down

0 comments on commit 0c2f3f8

Please sign in to comment.