diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-06-22 21:06:28 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-06-22 21:06:43 +0300 |
commit | 73d3f51c16972d23b70d31c88786d7e3b37e7ff8 (patch) | |
tree | e38e4dd815b467feb1231df710d5566f1f1d7634 /source/blender/editors/sculpt_paint/paint_ops.c | |
parent | 15dda0115c783805753119984decb4d9249b1f01 (diff) |
Fix T78136: Image editor - crash to desktop with changing the threshold for extract palette
Also fixed the same error in generate GPencil object from image.
The problem was the Render Result image hasn't ibuf.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 0f54d5e0821..0f0af335481 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -304,7 +304,10 @@ static bool palette_extract_img_poll(bContext *C) { SpaceLink *sl = CTX_wm_space_data(C); if ((sl != NULL) && (sl->spacetype == SPACE_IMAGE)) { - return true; + SpaceImage *sima = CTX_wm_space_image(C); + Image *image = sima->image; + ImageUser iuser = sima->iuser; + return BKE_image_has_ibuf(image, &iuser); } return false; @@ -326,7 +329,7 @@ static int palette_extract_img_exec(bContext *C, wmOperator *op) ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock); - if (ibuf->rect) { + if (ibuf && ibuf->rect) { /* Extract all colors. */ for (int row = 0; row < ibuf->y; row++) { for (int col = 0; col < ibuf->x; col++) { |