fix [#34125] Crash when bake margin = 0
authorCampbell Barton <ideasman42@gmail.com>
Wed, 6 Feb 2013 00:48:17 +0000 (00:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 6 Feb 2013 00:48:17 +0000 (00:48 +0000)
regression since 2.65, just missing NULL check.

source/blender/render/intern/source/bake.c

index 665361e..f304ca5 100644 (file)
@@ -1072,12 +1072,14 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
                                if (!ibuf)
                                        continue;
 
-                               userdata = (BakeImBufuserData *) ibuf->userdata;
-                               RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, re->r.bake_filter);
+                               if (userdata) {
+                                       userdata = (BakeImBufuserData *) ibuf->userdata;
+                                       RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, re->r.bake_filter);
 
-                               if (use_displacement_buffer) {
-                                       RE_bake_ibuf_normalize_displacement(ibuf, userdata->displacement_buffer, userdata->mask_buffer,
-                                                                           displacement_min, displacement_max);
+                                       if (use_displacement_buffer) {
+                                               RE_bake_ibuf_normalize_displacement(ibuf, userdata->displacement_buffer, userdata->mask_buffer,
+                                                                                   displacement_min, displacement_max);
+                                       }
                                }
 
                                ibuf->userflags |= IB_BITMAPDIRTY;