瀏覽代碼

image-source: Prevent random_file call when file list empty

Simple workaround to prevent integer division by zero in random_file
when add new source.

Closes jp9000/obs-studio#550
SuslikV 10 年之前
父節點
當前提交
8a9cbaae18
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      plugins/image-source/obs-slideshow.c

+ 1 - 1
plugins/image-source/obs-slideshow.c

@@ -297,7 +297,7 @@ static void ss_update(void *data, obs_data_t *settings)
 	obs_transition_set_scale_type(ss->transition,
 			OBS_TRANSITION_SCALE_ASPECT);
 
-	if (ss->randomize)
+	if (ss->randomize && ss->files.num)
 		ss->cur_item = random_file(ss);
 	if (new_tr)
 		obs_source_add_active_child(ss->source, new_tr);