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.
This commit is contained in:
Julian Eisel 2021-09-10 14:41:20 +02:00
parent 7f1fe10595
commit 7a5216497c
Notes: blender-bot 2023-02-14 02:30:10 +01:00
Referenced by commit eb96f0cf06, Add missing bit to own previous commit
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}
}