diff --git a/src/Gui/CommandFeat.cpp b/src/Gui/CommandFeat.cpp index 30b65ee3a7..56df7d1821 100644 --- a/src/Gui/CommandFeat.cpp +++ b/src/Gui/CommandFeat.cpp @@ -104,12 +104,15 @@ void StdCmdRandomColor::activated(int iMsg) vpLink->ShapeMaterial.setDiffuseColor(objColor); } else if (view) { - auto appearance = - dynamic_cast(view->getPropertyByName("ShapeAppearance")); - if (appearance) { - // get the view provider of the selected object and set the shape color - appearance->setDiffuseColor(objColor); + // clang-format off + // get the view provider of the selected object and set the shape color + if (auto prop = dynamic_cast(view->getPropertyByName("ShapeAppearance"))) { + prop->setDiffuseColor(objColor); } + else if (auto prop = dynamic_cast(view->getPropertyByName("ShapeAppearance"))) { + prop->setDiffuseColor(objColor); + } + // clang-format on } };