diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-01-20 10:37:04 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-01-21 18:32:26 +0300 |
commit | 42360e64dab6d61877898669eb711bcdd8eed504 (patch) | |
tree | ec8c6be225e7946f62edcea0ced50d9af7c2c362 /source/blender/editors/space_image | |
parent | 98a99cb763949b6a73c8dec76e9a7f3a604f8862 (diff) |
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
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |