Fix crash when adding modifiers to curve/surface/text objects

This commit is contained in:
2020-01-29 22:53:11 +01:00
parent 6576148722
commit c7c8ee6168

View File

@@ -826,11 +826,12 @@ GPUBatch *DRW_cache_object_surface_get(Object *ob)
int DRW_cache_object_material_count_get(struct Object *ob)
{
Mesh *me = (ob->runtime.mesh_eval != NULL) ? ob->runtime.mesh_eval : (Mesh *)ob->data;
short type = (ob->runtime.mesh_eval != NULL) ? OB_MESH : ob->type;
switch (type) {
case OB_MESH:
return DRW_mesh_material_count_get(ob->data);
return DRW_mesh_material_count_get(me);
case OB_CURVE:
case OB_SURF:
case OB_FONT: