diff --git a/src/Mod/PartDesign/Gui/ViewProviderHole.cpp b/src/Mod/PartDesign/Gui/ViewProviderHole.cpp index 72c4210192..3137367dfc 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderHole.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderHole.cpp @@ -333,15 +333,11 @@ std::optional ViewProviderHole::getHoleOrigin(const PartDesign::Hole* pc if (!pcHole) { return std::nullopt; } - - auto* sketch = freecad_cast(pcHole->Profile.getValue()); - - if (!sketch) { - return std::nullopt; + if (auto* profile = pcHole->Profile.getValue()) { + const Base::Vector3d pos = profile->getPlacement().getPosition(); + return Base::convertTo(pos); } - - const Base::Vector3d& pos = sketch->Placement.getValue().getPosition(); - return Base::convertTo(pos); + return std::nullopt; } std::vector ViewProviderHole::collectBoreFaces(const PartDesign::Hole* pcHole) const