TechDraw: Fix some Coverity Unchecked dynamic_cast

CIDs from sasobadovinac-FreeCAD:
151684
151714
151715
151716
151718
151719
151720
151721
151722
151724
151725
151730
151749
151759
151771
151794
This commit is contained in:
Ian Rees
2016-08-15 23:05:07 +12:00
parent 66bd0f6b90
commit 34583fad05
7 changed files with 72 additions and 84 deletions

View File

@@ -213,15 +213,19 @@ void QGIView::setPosition(qreal x, qreal y)
double QGIView::getYInClip(double y)
{
QGCustomClip* parentClip = dynamic_cast<QGCustomClip*>(parentItem());
auto parentClip( dynamic_cast<QGCustomClip*>( parentItem() ) );
if (parentClip) {
QGIViewClip* parentView = dynamic_cast<QGIViewClip*>(parentClip->parentItem());
TechDraw::DrawViewClip* parentFeat = dynamic_cast<TechDraw::DrawViewClip*>(parentView->getViewObject());
double newY = parentFeat->Height.getValue() - y;
return newY;
} else {
Base::Console().Log("Logic Error - getYInClip called for child (%s) not in Clip\n",getViewName());
auto parentView( dynamic_cast<QGIViewClip*>( parentClip->parentItem() ) );
if (parentView) {
auto parentFeat( dynamic_cast<TechDraw::DrawViewClip*>(parentView->getViewObject()) );
if (parentFeat) {
return parentFeat->Height.getValue() - y;
}
}
}
Base::Console().Log( "Logic Error - getYInClip called for child "
"(%s) not in Clip\n", getViewName() );
return 0;
}