Extensions: Handle new dynamic_cast's
This commit is contained in:
@@ -1894,14 +1894,15 @@ DocumentObject * Document::addObject(const char* sType, const char* pObjectName,
|
||||
string ObjectName;
|
||||
if (!base)
|
||||
return 0;
|
||||
if (!base->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
|
||||
App::DocumentObject* pcObject = dynamic_cast<App::DocumentObject*>(base);
|
||||
if (!pcObject) {
|
||||
delete base;
|
||||
std::stringstream str;
|
||||
str << "'" << sType << "' is not a document object type";
|
||||
throw Base::TypeError(str.str());
|
||||
}
|
||||
|
||||
App::DocumentObject* pcObject = dynamic_cast<App::DocumentObject*>(base);
|
||||
pcObject->setDocument(this);
|
||||
|
||||
// do no transactions if we do a rollback!
|
||||
|
||||
Reference in New Issue
Block a user