do some security checks to make sure Py::Module is valid
This commit is contained in:
@@ -262,7 +262,7 @@ PyObject* AttachEnginePy::getModeInfo(PyObject* args)
|
||||
#endif
|
||||
try {
|
||||
Py::Module module(PyImport_ImportModule("PartGui"),true);
|
||||
if (!module.hasAttr("AttachEngineResources")) {
|
||||
if (module.isNull() || !module.hasAttr("AttachEngineResources")) {
|
||||
// in v0.14+, the GUI module can be loaded in console mode (but doesn't have all its document methods)
|
||||
throw Py::RuntimeError("Gui is not up");//DeepSOIC: wanted to throw ImportError here, but it's not defined, so I don't know...
|
||||
}
|
||||
@@ -357,7 +357,7 @@ PyObject* AttachEnginePy::getRefTypeInfo(PyObject* args)
|
||||
|
||||
try {
|
||||
Py::Module module(PyImport_ImportModule("PartGui"),true);
|
||||
if (!module.hasAttr("AttachEngineResources")) {
|
||||
if (module.isNull() || !module.hasAttr("AttachEngineResources")) {
|
||||
// in v0.14+, the GUI module can be loaded in console mode (but doesn't have all its document methods)
|
||||
throw Py::RuntimeError("Gui is not up");//DeepSOIC: wanted to throw ImportError here, but it's not defined, so I don't know...
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user