diff options
author | Julian Eisel <julian@blender.org> | 2021-09-10 15:41:20 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-09-10 15:44:09 +0300 |
commit | 7a5216497cc31e6d6e412a6d0aace8f17a51e585 (patch) | |
tree | 07bda3b527c4b12de48d45982f71a9d43a720e44 /source/blender/editors/space_file | |
parent | 7f1fe10595065128aab2a4aea4bc9c46e155053c (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.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 4 |
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; } } |