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
Notes: blender-bot 2023-02-14 10:46:09 +01:00
Referenced by issue #39833, Nurbs Crash
1 changed files with 5 additions and 3 deletions

View 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;
}