Fix T85499: Crash on switching to edit mode with uv editor open

A fix for T83187 (rBf83aa830) assumed in the overlay code of the uv editor that the object was a mesh
when it did not have to be - causing a crash.

The fix makes sure that the object is a mesh.

Reviewed By: jbakker, campbellbarton

Maniphest Tasks: T85499, T85495

Differential Revision: https://developer.blender.org/D10369
This commit is contained in:
Falk David 2021-02-15 20:08:42 +01:00
parent 9cccbbebaa
commit 3e55d7d605
Notes: blender-bot 2023-02-14 05:37:19 +01:00
Referenced by issue #85495, Crash when entering Armature Edit mode in 3D Viewport aside a UV Editor split window
Referenced by issue #85499, Edit Curve Crash
1 changed files with 2 additions and 1 deletions

View File

@ -401,7 +401,8 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata)
/* HACK: When editing objects that share the same mesh we should only draw the
* first one in the order that is used during uv editing. We can only trust that the first object
* has the correct batches with the correct selection state. See T83187. */
if (pd->edit_uv.do_uv_overlay || pd->edit_uv.do_uv_shadow_overlay) {
if ((pd->edit_uv.do_uv_overlay || pd->edit_uv.do_uv_shadow_overlay) &&
draw_ctx->obact->type == OB_MESH) {
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
draw_ctx->view_layer, NULL, &objects_len, draw_ctx->object_mode);