Part: FaceMaker: check if instance is actually created.

Part::FaceMaker::ConstructFromType() could return null pointer if
abstract class type is supplied.

Here, it is fixed by checking for null pointer in facemaker itself,
rather than in every place  ConstructFromType is being used.
This commit is contained in:
DeepSOIC
2016-10-02 21:10:46 +03:00
committed by wmayer
parent 56b153070d
commit 7b70711fb3
6 changed files with 10 additions and 32 deletions

View File

@@ -252,13 +252,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
PyErr_Clear();
if (PyArg_ParseTuple(args, "Os", &pcPyShapeOrList, &className)) {
try {
std::unique_ptr<FaceMaker> fm_instance = Part::FaceMaker::ConstructFromType(className);
FaceMaker* fm = fm_instance.get();
if (!fm) {
std::stringstream out;
out << "Cannot create FaceMaker from abstract type " << className;
throw Base::TypeError(out.str());
}
std::unique_ptr<FaceMaker> fm = Part::FaceMaker::ConstructFromType(className);
//dump all supplied shapes to facemaker, no matter what type (let facemaker decide).
if (PySequence_Check(pcPyShapeOrList)){