+ handle case when workbench fails to be created, fix problem when inserting menu

This commit is contained in:
wmayer
2015-05-06 10:47:51 +02:00
parent 7090587e45
commit 23a8a9359b
2 changed files with 8 additions and 3 deletions

View File

@@ -1006,6 +1006,8 @@ bool Application::activateWorkbench(const char* name)
type = result.as_std_string("ascii");
if (Base::Type::fromName(type.c_str()).isDerivedFrom(Gui::PythonBaseWorkbench::getClassTypeId())) {
Workbench* wb = WorkbenchManager::instance()->createWorkbench(name, type);
if (!wb)
throw Py::RuntimeError("Failed to instantiate workbench of type " + type);
handler.setAttr(std::string("__Workbench__"), Py::Object(wb->getPyObject(), true));
}