[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44634] trunk/blender/source/blender/ python/bmesh/bmesh_py_api.c: fix for missing NULL check in bmesh.from_mesh( ), bug [#30446]

Campbell Barton ideasman42 at gmail.com
Sun Mar 4 12:10:26 CET 2012


Revision: 44634
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44634
Author:   campbellbarton
Date:     2012-03-04 11:10:11 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
fix for missing NULL check in bmesh.from_mesh(), bug [#30446]

Modified Paths:
--------------
    trunk/blender/source/blender/python/bmesh/bmesh_py_api.c

Modified: trunk/blender/source/blender/python/bmesh/bmesh_py_api.c
===================================================================
--- trunk/blender/source/blender/python/bmesh/bmesh_py_api.c	2012-03-04 10:49:13 UTC (rev 44633)
+++ trunk/blender/source/blender/python/bmesh/bmesh_py_api.c	2012-03-04 11:10:11 UTC (rev 44634)
@@ -60,14 +60,19 @@
 {
 	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[] = {




More information about the Bf-blender-cvs mailing list