From e47e22e395c1ecdc894df5d1f0cf34ecbef17ae3 Mon Sep 17 00:00:00 2001 From: balazs-bamer Date: Wed, 11 Feb 2015 12:22:53 +0100 Subject: [PATCH] Check for null shape before calling ShapeType Check for null shape before calling ShapeType --- src/Mod/Surface/App/FeatureBSurf.cpp | 4 ++-- src/Mod/Surface/Gui/Command.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/Surface/App/FeatureBSurf.cpp b/src/Mod/Surface/App/FeatureBSurf.cpp index fd4c665464..d0dc734b2b 100644 --- a/src/Mod/Surface/App/FeatureBSurf.cpp +++ b/src/Mod/Surface/App/FeatureBSurf.cpp @@ -99,7 +99,7 @@ void BSurf::getWire(TopoDS_Wire& aWire) if(set.obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { const Part::TopoShape &ts = static_cast(set.obj)->Shape.getShape(); - if(ts._Shape.ShapeType() == TopAbs_WIRE) + if((!ts._Shape.IsNull()) && ts._Shape.ShapeType() == TopAbs_WIRE) { const TopoDS_Wire &wire = TopoDS::Wire(ts._Shape); // resolve the wire, we need edges from now on @@ -119,7 +119,7 @@ void BSurf::getWire(TopoDS_Wire& aWire) copier.Perform(sub); const TopoDS_Shape © = copier.Shape(); - if(copy.ShapeType() == TopAbs_EDGE) { //Check Shape type and assign edge + if((!copy.IsNull()) && copy.ShapeType() == TopAbs_EDGE) { //Check Shape type and assign edge aWD->Add(TopoDS::Edge(copy)); edgeCount++; } diff --git a/src/Mod/Surface/Gui/Command.cpp b/src/Mod/Surface/Gui/Command.cpp index 819d0c4630..4ff3146f61 100644 --- a/src/Mod/Surface/Gui/Command.cpp +++ b/src/Mod/Surface/Gui/Command.cpp @@ -231,7 +231,7 @@ bool CmdSurfaceBSurf::isActive(void) Part::TopoShape ts = static_cast((*it).pObject)->Shape.getShape(); try { // make sure the main shape type is edge or wire - if(ts._Shape.ShapeType() == TopAbs_WIRE) + if((!ts._Shape.IsNull()) && ts._Shape.ShapeType() == TopAbs_WIRE) { TopoDS_Wire wire = TopoDS::Wire(ts._Shape); for (TopExp_Explorer wireExplorer (wire, TopAbs_EDGE); wireExplorer.More(); wireExplorer.Next()) @@ -274,7 +274,7 @@ void CmdSurfaceBSurf::createSurface(const char *surfaceNamePrefix, const char *c Part::TopoShape ts = static_cast((*it).pObject)->Shape.getShape(); bspListCmd << "(App.activeDocument()." << it->FeatName; // if it is wire, add as wire - if(ts._Shape.ShapeType() == TopAbs_WIRE) + if((!ts._Shape.IsNull()) && ts._Shape.ShapeType() == TopAbs_WIRE) { bspListCmd << ", \'Wire1\'),"; }