Fix T39833: Nurbs Crash

Converting empty object to mesh can generate a 'Null' BL:Mesh, we have to check against it.
This commit is contained in:
Bastien Montagne 2014-04-21 23:41:39 +02:00
parent 9b0ab89067
commit 0e2f6c7fc4

@ -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) 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); BL::Mesh me = data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, false, calc_undeformed);
if ((bool)me) {
if (me.use_auto_smooth()) { if (me.use_auto_smooth()) {
me.calc_normals_split(me.auto_smooth_angle()); me.calc_normals_split(me.auto_smooth_angle());
} }
me.calc_tessface(); me.calc_tessface();
}
return me; return me;
} }