Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-09-10 15:41:20 +0300
committerJulian Eisel <julian@blender.org>2021-09-10 15:44:09 +0300
commit7a5216497cc31e6d6e412a6d0aace8f17a51e585 (patch)
tree07bda3b527c4b12de48d45982f71a9d43a720e44
parent7f1fe10595065128aab2a4aea4bc9c46e155053c (diff)
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.
-rw-r--r--source/blender/editors/space_file/filelist.c4
1 files changed, 3 insertions, 1 deletions
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;
}
}