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 | |
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')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_convert.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 7 |
3 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 4f1ede432ea..aa5803a5d5f 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1813,7 +1813,7 @@ bool BKE_gpencil_from_image(SpaceImage *sima, bGPDframe *gpf, const float size, ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock); - if (ibuf->rect) { + if (ibuf && ibuf->rect) { int img_x = ibuf->x; int img_y = ibuf->y; diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index f1b8ae61994..75249fbdd06 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -55,6 +55,7 @@ #include "BKE_global.h" #include "BKE_gpencil.h" #include "BKE_gpencil_geom.h" +#include "BKE_image.h" #include "BKE_layer.h" #include "BKE_main.h" #include "BKE_material.h" @@ -1773,7 +1774,10 @@ static bool image_to_gpencil_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; 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++) { |