Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_icons.c
| Show First 20 Lines • Show All 992 Lines • ▼ Show 20 Lines | |||||
| PreviewImage *pi = BKE_previewimg_id_ensure(id); | PreviewImage *pi = BKE_previewimg_id_ensure(id); | ||||
| if (pi == NULL) { | if (pi == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* For objects, first try if a preview can created via the object data. */ | /* For objects, first try if a preview can created via the object data. */ | ||||
| if (GS(id->name) == ID_OB) { | if (GS(id->name) == ID_OB) { | ||||
| Object *ob = (Object *)id; | Object *ob = (Object *)id; | ||||
| if (ED_preview_id_is_supported(ob->data)) { | if (ob->data && ED_preview_id_is_supported(ob->data)) { | ||||
sybren: It would be better to have `ED_preview_id_is_supported` NULL-safe. You can just add
```lang=c… | |||||
| id = ob->data; | id = ob->data; | ||||
| } | } | ||||
| } | } | ||||
| if (!ED_preview_id_is_supported(id)) { | if (!ED_preview_id_is_supported(id)) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 479 Lines • Show Last 20 Lines | |||||
It would be better to have ED_preview_id_is_supported NULL-safe. You can just add
to the function. Semantically it makes sense as well, as NULL cannot have a preview.