[Bf-blender-cvs] [549a1cac88a] blender-v2.91-release: Fix T82810: UV Editor, Crash with switching between single image and UDIM tile

Jeroen Bakker noreply at git.blender.org
Wed Nov 18 13:14:44 CET 2020


Commit: 549a1cac88a12193faf2251edb1134270e8a1360
Author: Jeroen Bakker
Date:   Wed Nov 18 13:12:19 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB549a1cac88a12193faf2251edb1134270e8a1360

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.

===================================================================

M	source/blender/draw/engines/overlay/overlay_edit_uv.c

===================================================================

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);
+      }
     }
   }



More information about the Bf-blender-cvs mailing list