Przeglądaj źródła

Fix bug magickcore file loading freeze

This seemed to happen if the 'file' variable was NULL.  For some reason,
magickcore would just totally freeze.
jp9000 11 lat temu
rodzic
commit
f313aaa5a6
1 zmienionych plików z 9 dodań i 3 usunięć
  1. 9 3
      libobs/graphics/graphics-magick.c

+ 9 - 3
libobs/graphics/graphics-magick.c

@@ -14,11 +14,17 @@ void gs_free_image_deps()
 
 
 texture_t gs_create_texture_from_file(const char *file)
 texture_t gs_create_texture_from_file(const char *file)
 {
 {
-	texture_t     tex        = NULL;
-	ImageInfo     *info      = CloneImageInfo(NULL);
-	ExceptionInfo *exception = AcquireExceptionInfo();
+	texture_t     tex = NULL;
+	ImageInfo     *info;
+	ExceptionInfo *exception;
 	Image         *image;
 	Image         *image;
 
 
+	if (!file || !*file)
+		return NULL;
+
+	info      = CloneImageInfo(NULL);
+	exception = AcquireExceptionInfo();
+
 	strcpy(info->filename, file);
 	strcpy(info->filename, file);
 	image = ReadImage(info, exception);
 	image = ReadImage(info, exception);
 	if (image) {
 	if (image) {