Fix T39833: Nurbs Crash
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 21 Apr 2014 21:41:39 +0000 (23:41 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 21 Apr 2014 21:41:39 +0000 (23:41 +0200)
Converting empty object to mesh can generate a 'Null' BL:Mesh, we have to check against it.

intern/cycles/blender/blender_util.h

index b2046b290b22b7c1491b2aaae66256bffb5fc586..2c83ee6c2b581f08f152382da2f52cddece68708 100644 (file)
@@ -43,10 +43,12 @@ void python_thread_state_restore(void **python_thread_state);
 static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render, bool calc_undeformed)
 {
        BL::Mesh me = data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed);
-       if (me.use_auto_smooth()) {
-               me.calc_normals_split(me.auto_smooth_angle());
+       if ((bool)me) {
+               if (me.use_auto_smooth()) {
+                       me.calc_normals_split(me.auto_smooth_angle());
+               }
+               me.calc_tessface();
        }
-       me.calc_tessface();
        return me;
 }