Fix T38298: crash saving float image with 3 channels from exr to png/jpeg.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 21 Jan 2014 14:28:13 +0000 (15:28 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 21 Jan 2014 14:29:52 +0000 (15:29 +0100)
source/blender/imbuf/intern/divers.c

index e33f4d40b55ddf5613a76a340e8cb152c25273a7..e147b810cfd42f7470ea11466b06173bf82bf8d1 100644 (file)
@@ -552,7 +552,8 @@ void IMB_rect_from_float(ImBuf *ibuf)
        IMB_colormanagement_transform(buffer, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, ibuf->rect_colorspace->name, true);
 
        /* convert from float's premul alpha to byte's straight alpha */
-       IMB_unpremultiply_rect_float(buffer, ibuf->planes, ibuf->x, ibuf->y);
+       if (ibuf->channels == 4)
+               IMB_unpremultiply_rect_float(buffer, ibuf->planes, ibuf->x, ibuf->y);
 
        /* convert float to byte */
        IMB_buffer_byte_from_float((unsigned char *) ibuf->rect, buffer, ibuf->channels, ibuf->dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB,