[Bf-blender-cvs] [3da7226] master: Freestyle: Fixed a crash due to missing call of StrokeShader.__init__() in Python.

Tamito Kajiyama noreply at git.blender.org
Wed Apr 22 18:15:39 CEST 2015


Commit: 3da722684462f0ef6c7fedbdac67a67943815455
Author: Tamito Kajiyama
Date:   Wed Apr 22 23:19:43 2015 +0900
Branches: master
https://developer.blender.org/rB3da722684462f0ef6c7fedbdac67a67943815455

Freestyle: Fixed a crash due to missing call of StrokeShader.__init__() in Python.

Many thanks to the problem report by flokkievids (Folkert de Vries)
through a comment in Patch D963.

===================================================================

M	source/blender/freestyle/intern/python/BPy_Operators.cpp

===================================================================

diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp
index a214fc4..1b2b18c 100644
--- a/source/blender/freestyle/intern/python/BPy_Operators.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp
@@ -34,6 +34,8 @@
 #include "BPy_StrokeShader.h"
 #include "BPy_Convert.h"
 
+#include <sstream>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -539,7 +541,15 @@ static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyOb
 			PyErr_SetString(PyExc_TypeError, "Operators.create(): 2nd argument must be a list of StrokeShader objects");
 			return NULL;
 		}
-		shaders.push_back(((BPy_StrokeShader *)py_ss)->ss);
+		StrokeShader *shader = ((BPy_StrokeShader *)py_ss)->ss;
+		if (!shader) {
+			stringstream ss;
+			ss << "Operators.create(): item " << (i + 1)
+			   << " of the shaders list is invalid likely due to missing call of StrokeShader.__init__()";
+			PyErr_SetString(PyExc_TypeError, ss.str().c_str());
+			return NULL;
+		}
+		shaders.push_back(shader);
 	}
 	if (Operators::create(*(((BPy_UnaryPredicate1D *)obj1)->up1D), shaders) < 0) {
 		if (!PyErr_Occurred())




More information about the Bf-blender-cvs mailing list