Fix T93431: Crash when empty is marked as asset

Make `ED_preview_id_is_supported(ID *)` NULL-safe. It's semantically
valid, as it's not possible to render a preview of a NULL ID.

The crash was introduced in 481f032f5c

Reviewed By: sybren, jbakker

Maniphest Tasks: T93431

Differential Revision: https://developer.blender.org/D13398
This commit is contained in:
Pratik Borhade 2021-11-29 15:24:44 +01:00 committed by Sybren A. Stüvel
parent b31250feba
commit 03c9563582
Notes: blender-bot 2023-02-13 17:00:34 +01:00
Referenced by issue #93431, Asset Browser: Crash on add Empty or collection instance
1 changed files with 4 additions and 0 deletions

View File

@ -1764,6 +1764,10 @@ static void icon_preview_free(void *customdata)
*/
bool ED_preview_id_is_supported(const ID *id)
{
if (id == NULL) {
return false;
}
if (GS(id->name) == ID_OB) {
return object_preview_is_type_supported((const Object *)id);
}