PVS: V595 The pointer was utilized before it was verified against nullptr
This commit is contained in:
@@ -614,7 +614,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
for (auto plane: datumPlanes) {
|
||||
planes.push_back ( plane );
|
||||
// Check whether this plane belongs to the active body
|
||||
if ( pcActiveBody && pcActiveBody->hasObject(plane) ) {
|
||||
if ( pcActiveBody->hasObject(plane) ) {
|
||||
if ( !pcActiveBody->isAfterInsertPoint ( plane ) ) {
|
||||
validPlaneCount++;
|
||||
status.push_back(PartDesignGui::TaskFeaturePick::validFeature);
|
||||
@@ -648,7 +648,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
auto shapeBinders( getDocument()->getObjectsOfType(PartDesign::ShapeBinder::getClassTypeId()) );
|
||||
for (auto binder : shapeBinders) {
|
||||
// Check whether this plane belongs to the active body
|
||||
if (pcActiveBody && pcActiveBody->hasObject(binder)) {
|
||||
if (pcActiveBody->hasObject(binder)) {
|
||||
TopoDS_Shape shape = static_cast<Part::Feature*>(binder)->Shape.getValue();
|
||||
if (!shape.IsNull() && shape.ShapeType() == TopAbs_FACE) {
|
||||
const TopoDS_Face& face = TopoDS::Face(shape);
|
||||
|
||||
@@ -105,6 +105,10 @@ void CmdPrimtiveCompAdditive::activated(int iMsg)
|
||||
pcActiveBody = PartDesignGui::makeBody(doc);
|
||||
}
|
||||
|
||||
if (pcActiveBody == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
"App.ActiveDocument.addObject(\'PartDesign::Additive%s\',\'%s\')",
|
||||
@@ -118,13 +122,11 @@ void CmdPrimtiveCompAdditive::activated(int iMsg)
|
||||
if (prm->BaseFeature.getValue())
|
||||
doCommand(Gui,"Gui.activeDocument().hide(\"%s\")", prm->BaseFeature.getValue()->getNameInDocument());
|
||||
|
||||
if (pcActiveBody) {
|
||||
copyVisual(FeatName.c_str(), "ShapeColor", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "LineColor", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "PointColor", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "Transparency", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "DisplayMode", pcActiveBody->getNameInDocument());
|
||||
}
|
||||
copyVisual(FeatName.c_str(), "ShapeColor", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "LineColor", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "PointColor", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "Transparency", pcActiveBody->getNameInDocument());
|
||||
copyVisual(FeatName.c_str(), "DisplayMode", pcActiveBody->getNameInDocument());
|
||||
|
||||
Gui::Command::doCommand(Gui, "Gui.activeDocument().setEdit(\'%s\')", FeatName.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user