From 38442ae2dc7ff9fe656b715e0ac92c465dccc7ee Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Apr 2016 09:37:51 +1000 Subject: Fix image-space mask-transform crash w/o an image --- source/blender/blenkernel/intern/image.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 63cc57d0a21..cdb3d1afc29 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -4494,13 +4494,17 @@ void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height) ImBuf *ibuf = NULL; void *lock; - ibuf = BKE_image_acquire_ibuf(image, iuser, &lock); + if (image != NULL) { + ibuf = BKE_image_acquire_ibuf(image, iuser, &lock); + } if (ibuf && ibuf->x > 0 && ibuf->y > 0) { *width = ibuf->x; *height = ibuf->y; } - else if (image->type == IMA_TYPE_R_RESULT && iuser != NULL && iuser->scene != NULL) { + else if (image != NULL && image->type == IMA_TYPE_R_RESULT && + iuser != NULL && iuser->scene != NULL) + { Scene *scene = iuser->scene; *width = (scene->r.xsch * scene->r.size) / 100; *height = (scene->r.ysch * scene->r.size) / 100; @@ -4514,7 +4518,9 @@ void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height) *height = IMG_SIZE_FALLBACK; } - BKE_image_release_ibuf(image, ibuf, lock); + if (image != NULL) { + BKE_image_release_ibuf(image, ibuf, lock); + } } void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float size[2]) -- cgit v1.2.3