[Bf-blender-cvs] [38442ae] master: Fix image-space mask-transform crash w/o an image

Campbell Barton noreply at git.blender.org
Wed Apr 20 01:37:55 CEST 2016


Commit: 38442ae2dc7ff9fe656b715e0ac92c465dccc7ee
Author: Campbell Barton
Date:   Wed Apr 20 09:37:51 2016 +1000
Branches: master
https://developer.blender.org/rB38442ae2dc7ff9fe656b715e0ac92c465dccc7ee

Fix image-space mask-transform crash w/o an image

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

M	source/blender/blenkernel/intern/image.c

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

diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 63cc57d..cdb3d1a 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])




More information about the Bf-blender-cvs mailing list