Fix for possible NULL pointer use in brush image sampling
authorCampbell Barton <ideasman42@gmail.com>
Tue, 17 Dec 2013 02:19:54 +0000 (13:19 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 17 Dec 2013 02:19:54 +0000 (13:19 +1100)
source/blender/blenkernel/intern/brush.c

index 8a59aab403671ad8fcd9d8cb2d001ae1cd2564ef..f8fa549fcd9689f3cf43bc27659dbb3e40b1afd6 100644 (file)
@@ -644,7 +644,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
                if (br->mtex.tex->type == TEX_IMAGE && br->mtex.tex->ima) {
                        ImBuf *tex_ibuf = BKE_image_pool_acquire_ibuf(br->mtex.tex->ima, &br->mtex.tex->iuser, pool);
                        /* For consistency, sampling always returns color in linear space */
-                       if (tex_ibuf->rect_float == NULL) {
+                       if (tex_ibuf && tex_ibuf->rect_float == NULL) {
                                IMB_colormanagement_colorspace_to_scene_linear_v3(rgba, tex_ibuf->rect_colorspace);
                        }
                        BKE_image_pool_release_ibuf(br->mtex.tex->ima, tex_ibuf, pool);