diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-11-18 15:12:19 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-11-18 15:12:19 +0300 |
commit | 549a1cac88a12193faf2251edb1134270e8a1360 (patch) | |
tree | e31e056a204243cf9fce457068217f828e1d3268 /source | |
parent | 4b55abc335558262c1c897738b159b7a0b0ef5f9 (diff) |
Fix T82810: UV Editor, Crash with switching between single image and UDIM tile
Active tile could be NULL when it was on the second tile before
switching back and forth between the Image/UDIM.
In the future we might also check that the active_tile_index is always
valid.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_edit_uv.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c b/source/blender/draw/engines/overlay/overlay_edit_uv.c index e21b6b30d22..045a38ef374 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.c +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c @@ -268,11 +268,13 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata) if (pd->edit_uv.do_tiled_image_overlay) { /* Active tile border */ ImageTile *active_tile = BLI_findlink(&image->tiles, image->active_tile_index); - obmat[3][0] = (float)((active_tile->tile_number - 1001) % 10); - obmat[3][1] = (float)((active_tile->tile_number - 1001) / 10); - grp = DRW_shgroup_create(sh, psl->edit_uv_tiled_image_borders_ps); - DRW_shgroup_uniform_vec4_copy(grp, "color", selected_color); - DRW_shgroup_call_obmat(grp, geom, obmat); + if (active_tile) { + obmat[3][0] = (float)((active_tile->tile_number - 1001) % 10); + obmat[3][1] = (float)((active_tile->tile_number - 1001) / 10); + grp = DRW_shgroup_create(sh, psl->edit_uv_tiled_image_borders_ps); + DRW_shgroup_uniform_vec4_copy(grp, "color", selected_color); + DRW_shgroup_call_obmat(grp, geom, obmat); + } } } |