diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-27 04:39:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-27 04:39:51 +0400 |
commit | 79f7a78637d4b1691ab1469ee2785d66712c28fb (patch) | |
tree | 48cdb159ebaaf962f3649adfac3c9385fef1de49 | |
parent | 8ef934c73f3baeaa582efb8de906b27a3854979c (diff) |
fix [#36528] crash when reinitializing bmesh from mesh
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index e6842051e31..ad11ead29a2 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1047,6 +1047,8 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject * int use_shape_key = false; int shape_key_index = 0; + BPY_BM_CHECK_OBJ(self); + if (!PyArg_ParseTupleAndKeywords(args, kw, "O|iii:from_mesh", (char **)kwlist, &py_mesh, &use_fnorm, &use_shape_key, &shape_key_index) || !(me = PyC_RNA_AsPointer(py_mesh, "Mesh"))) @@ -2918,7 +2920,8 @@ static void bpy_bmvert_dealloc(BPy_BMElem *self) BMesh *bm = self->bm; if (bm) { void **ptr = CustomData_bmesh_get(&bm->vdata, self->ele->head.data, CD_BM_ELEM_PYPTR); - *ptr = NULL; + if (ptr) + *ptr = NULL; } PyObject_DEL(self); } @@ -2928,7 +2931,8 @@ static void bpy_bmedge_dealloc(BPy_BMElem *self) BMesh *bm = self->bm; if (bm) { void **ptr = CustomData_bmesh_get(&bm->edata, self->ele->head.data, CD_BM_ELEM_PYPTR); - *ptr = NULL; + if (ptr) + *ptr = NULL; } PyObject_DEL(self); } @@ -2938,7 +2942,8 @@ static void bpy_bmface_dealloc(BPy_BMElem *self) BMesh *bm = self->bm; if (bm) { void **ptr = CustomData_bmesh_get(&bm->pdata, self->ele->head.data, CD_BM_ELEM_PYPTR); - *ptr = NULL; + if (ptr) + *ptr = NULL; } PyObject_DEL(self); } @@ -2948,7 +2953,8 @@ static void bpy_bmloop_dealloc(BPy_BMElem *self) BMesh *bm = self->bm; if (bm) { void **ptr = CustomData_bmesh_get(&bm->ldata, self->ele->head.data, CD_BM_ELEM_PYPTR); - *ptr = NULL; + if (ptr) + *ptr = NULL; } PyObject_DEL(self); } |