[Bf-blender-cvs] [7a5216497cc] master: Fix possible crash displaying asset preview from current file

Julian Eisel noreply at git.blender.org
Fri Sep 10 14:44:15 CEST 2021


Commit: 7a5216497cc31e6d6e412a6d0aace8f17a51e585
Author: Julian Eisel
Date:   Fri Sep 10 14:41:20 2021 +0200
Branches: master
https://developer.blender.org/rB7a5216497cc31e6d6e412a6d0aace8f17a51e585

Fix possible crash displaying asset preview from current file

For some reason the asset preview isn't created or loaded correctly in
some instances. This could be addressed with D9974, but hard to tell
since I only have a failing .blend file, no steps to recreate it from
scratch.

Would crash when opening an Asset Browser, selecting an object asset
(that has an invalid preview stored) and opening the Asset Browser
sidebar, so that the preview is visible there.

===================================================================

M	source/blender/editors/space_file/filelist.c

===================================================================

diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index c7d23943b6c..46978972821 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1442,7 +1442,9 @@ static void filelist_cache_preview_runf(TaskPool *__restrict pool, void *taskdat
   if (preview->in_memory_preview) {
     if (BKE_previewimg_is_finished(preview->in_memory_preview, ICON_SIZE_PREVIEW)) {
       ImBuf *imbuf = BKE_previewimg_to_imbuf(preview->in_memory_preview, ICON_SIZE_PREVIEW);
-      preview->icon_id = BKE_icon_imbuf_create(imbuf);
+      if (imbuf) {
+        preview->icon_id = BKE_icon_imbuf_create(imbuf);
+      }
       done = true;
     }
   }



More information about the Bf-blender-cvs mailing list