handle possible crashes with FaceMaker and fix a few coding flaws
This commit is contained in:
@@ -251,9 +251,14 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
PyObject* pcPyShapeOrList = nullptr;
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "Os", &pcPyShapeOrList, &className)) {
|
||||
try{
|
||||
try {
|
||||
std::unique_ptr<FaceMaker> fm_instance = Part::FaceMaker::ConstructFromType(className);
|
||||
FaceMaker* fm = &(*fm_instance);
|
||||
FaceMaker* fm = fm_instance.get();
|
||||
if (!fm) {
|
||||
std::stringstream out;
|
||||
out << "Cannot create FaceMaker from abstract type " << className;
|
||||
throw Base::TypeError(out.str());
|
||||
}
|
||||
|
||||
//dump all supplied shapes to facemaker, no matter what type (let facemaker decide).
|
||||
if (PySequence_Check(pcPyShapeOrList)){
|
||||
@@ -293,7 +298,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
|
||||
return -1;
|
||||
}
|
||||
} ;
|
||||
}
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError,
|
||||
"Argument list signature is incorrect.\n\nSupported signatures:\n"
|
||||
|
||||
Reference in New Issue
Block a user