[Bf-blender-cvs] [42360e64dab] blender-v2.82-release: Fix T73233: Image Editor Color Picker Crash

Jeroen Bakker noreply at git.blender.org
Tue Jan 21 16:33:00 CET 2020


Commit: 42360e64dab6d61877898669eb711bcdd8eed504
Author: Jeroen Bakker
Date:   Mon Jan 20 08:37:04 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB42360e64dab6d61877898669eb711bcdd8eed504

Fix T73233: Image Editor Color Picker Crash

When using the color picker on a image editor it tries to read the color
from the original image. When there is no original image the code
crashes during the determination of the UDIM tile number.

There are 2 approaches to solve this.
1. Modify `BKE_image_get_tile_from_pos` to support NULL pointers.
2. Modify `ED_space_image_color_sample` with an early exit.

This patch modifies `ED_space_image_color_sample` with an early exit.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D6629

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

M	source/blender/editors/space_image/image_ops.c

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

diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 2ed8b8c87ff..17c6f76a1d9 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -3356,6 +3356,9 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info)
 /* Returns color in linear space, matching ED_space_node_color_sample(). */
 bool ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], float r_col[3])
 {
+  if (sima->image == NULL) {
+    return false;
+  }
   float uv[2];
   UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &uv[0], &uv[1]);
   int tile = BKE_image_get_tile_from_pos(sima->image, uv, uv, NULL);



More information about the Bf-blender-cvs mailing list