From 0ff7c3a38f7d5c1d948694886c28ef405f578f82 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Mon, 23 Sep 2024 18:58:09 -0400 Subject: [PATCH] [TD]fix crash on bad selection (fix #16727) --- src/Mod/TechDraw/Gui/CommandAnnotate.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index 62aea8fcc2..949ea63dce 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -1633,8 +1633,9 @@ void CmdTechDrawSurfaceFinishSymbols::activated(int iMsg) } else { auto objFeat = dynamic_cast(selection.front().getObject()); - if (!objFeat->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) - && !objFeat->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) { + if ( !objFeat || + !(objFeat->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) || + objFeat->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) ) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("SurfaceFinishSymbols"), QObject::tr("Selected object is not a part view, nor a leader line")); return;