diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-04 15:10:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-04 15:10:11 +0400 |
commit | 34db81a6dc9176e74beee656e4bc03971dc22430 (patch) | |
tree | 4895de61b8a667a0b5221c657ff565cf2df0f9e6 /source/blender/python | |
parent | dceab32f7874bdfd03fb936a51af38966ecc20d5 (diff) |
fix for missing NULL check in bmesh.from_mesh(), bug [#30446]
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_api.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index b6064c452fe..375e7cfae14 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -60,14 +60,19 @@ static PyObject *bpy_bm_from_mesh(PyObject *UNUSED(self), PyObject *value) { Mesh *me = PyC_RNA_AsPointer(value, "Mesh"); - /* temp! */ - if (!me->edit_btmesh) { - PyErr_SetString(PyExc_ValueError, - "Mesh is not in editmode"); + if (me) { + /* temp! */ + if (!me->edit_btmesh) { + PyErr_SetString(PyExc_ValueError, + "Mesh is not in editmode"); + return NULL; + } + + return BPy_BMesh_CreatePyObject(me->edit_btmesh->bm); + } + else { return NULL; } - - return BPy_BMesh_CreatePyObject(me->edit_btmesh->bm); } static struct PyMethodDef BPy_BM_methods[] = { |