Coverity: Uncaught exception

This commit is contained in:
wmayer
2020-07-20 13:58:15 +02:00
parent c5c8b21cc4
commit 9b2a6edeb0
4 changed files with 81 additions and 46 deletions

View File

@@ -593,7 +593,7 @@ void PartGui::DlgProjectionOnSurface::higlight_object(Part::Feature* iCurrentObj
{
if (!iCurrentObject) return;
auto partenShape = iCurrentObject->Shape.getShape().getShape();
auto subShape = iCurrentObject->Shape.getShape().getSubShape(iShapeName.c_str());
auto subShape = iCurrentObject->Shape.getShape().getSubShape(iShapeName.c_str(), true);
TopoDS_Shape currentShape = subShape;
if (subShape.IsNull()) currentShape = partenShape;

View File

@@ -120,19 +120,24 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj
TaskPipeParameters::~TaskPipeParameters()
{
if (vp) {
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = vp->getDocument();
try {
if (vp) {
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = vp->getDocument();
//make sure the user sees all important things: the
//spine/auxiliary spine he already selected
if (pipe->Spine.getValue()) {
auto* svp = doc->getViewProvider(pipe->Spine.getValue());
svp->setVisible(spineShow);
spineShow = false;
//make sure the user sees all important things: the
//spine/auxiliary spine he already selected
if (pipe->Spine.getValue()) {
auto* svp = doc->getViewProvider(pipe->Spine.getValue());
svp->setVisible(spineShow);
spineShow = false;
}
static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, false);
}
static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, false);
}
catch (const Base::RuntimeError&) {
// getDocument() may raise an exception
}
delete ui;
@@ -420,19 +425,24 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, bool /*newO
TaskPipeOrientation::~TaskPipeOrientation()
{
if (vp) {
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = vp->getDocument();
try {
if (vp) {
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = vp->getDocument();
//make sure the user sees al important things: the base feature to select edges and the
//spine/auxiliary spine he already selected
if (pipe->AuxillerySpine.getValue()) {
auto* svp = doc->getViewProvider(pipe->AuxillerySpine.getValue());
svp->setVisible(auxSpineShow);
auxSpineShow = false;
//make sure the user sees al important things: the base feature to select edges and the
//spine/auxiliary spine he already selected
if (pipe->AuxillerySpine.getValue()) {
auto* svp = doc->getViewProvider(pipe->AuxillerySpine.getValue());
svp->setVisible(auxSpineShow);
auxSpineShow = false;
}
static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, true);
}
static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, true);
}
catch (const Base::RuntimeError&) {
// getDocument() may raise an exception
}
}