Selaa lähdekoodia

Prevent loading image files with null/empty paths

jp9000 11 vuotta sitten
vanhempi
sitoutus
c9e225d719
2 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 3 0
      libobs/graphics/graphics-ffmpeg.c
  2. 1 1
      plugins/image-source/image-source.c

+ 3 - 0
libobs/graphics/graphics-ffmpeg.c

@@ -59,6 +59,9 @@ static bool ffmpeg_image_init(struct ffmpeg_image *info, const char *file)
 {
 	int ret;
 
+	if (!file || !*file)
+		return false;
+
 	memset(info, 0, sizeof(struct ffmpeg_image));
 	info->file       = file;
 	info->stream_idx = -1;

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

@@ -29,7 +29,7 @@ static void image_source_update(void *data, obs_data_t settings)
 		context->tex = NULL;
 	}
 
-	if (file) {
+	if (file && *file) {
 		context->tex = gs_create_texture_from_file(file);
 		if (context->tex) {
 			context->cx = texture_getwidth(context->tex);