diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2015-04-22 17:19:43 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2015-04-22 19:12:55 +0300 |
commit | 3da722684462f0ef6c7fedbdac67a67943815455 (patch) | |
tree | b2e3c5d50b9c27dbfa6aa9ed2d5ee5e1dc3885da | |
parent | 798facbff3a3aca7dc09e4609c2e848cd6bf26c9 (diff) |
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.
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_Operators.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index a214fc444c7..1b2b18c2c99 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()) |