Coverity: Unchecked dynamic_cast
This commit is contained in:
@@ -362,6 +362,9 @@ void CosmeticEdgePy::setCenter(Py::Object arg)
|
||||
pNew = DrawUtil::invertY(pNew);
|
||||
auto oldGeom = getCosmeticEdgePtr()->m_geometry;
|
||||
TechDraw::Circle* oldCircle = dynamic_cast<TechDraw::Circle*>(oldGeom);
|
||||
if (oldCircle == nullptr) {
|
||||
throw Py::TypeError("Edge geometry is not a circle");
|
||||
}
|
||||
|
||||
getCosmeticEdgePtr()->permaStart = pNew;
|
||||
getCosmeticEdgePtr()->permaEnd = pNew;
|
||||
|
||||
@@ -235,11 +235,11 @@ DrawPage* DrawView::findParentPage() const
|
||||
std::vector<App::DocumentObject*> parent = getInList();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = parent.begin(); it != parent.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) {
|
||||
page = dynamic_cast<TechDraw::DrawPage *>(*it);
|
||||
page = static_cast<TechDraw::DrawPage *>(*it);
|
||||
}
|
||||
|
||||
if ((*it)->getTypeId().isDerivedFrom(DrawViewCollection::getClassTypeId())) {
|
||||
collection = dynamic_cast<TechDraw::DrawViewCollection *>(*it);
|
||||
collection = static_cast<TechDraw::DrawViewCollection *>(*it);
|
||||
page = collection->findParentPage();
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ std::vector<TopoDS_Shape> ShapeExtractor::getXShapes(const App::Link* xLink)
|
||||
// }
|
||||
Base::Placement childPlm;
|
||||
if (l->getTypeId().isDerivedFrom(App::LinkElement::getClassTypeId())) {
|
||||
App::LinkElement* cLinkElem = dynamic_cast<App::LinkElement*>(l);
|
||||
App::LinkElement* cLinkElem = static_cast<App::LinkElement*>(l);
|
||||
if (cLinkElem->hasPlacement()) {
|
||||
childPlm = cLinkElem->getLinkPlacementProperty()->getValue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user