[Sketcher] Prevent dereferencing nullptr in ConstraintView
Fixes #8104. As described in that issue, a crash happens under the following conditions: 1. A `DrawSketchHandler` is active. 2. No constraint is selected. 3. Context menu on the `ConstraintView` is triggered.
This commit is contained in:
@@ -450,7 +450,7 @@ void ConstraintView::contextMenuEvent (QContextMenuEvent* event)
|
||||
bool didRelease = SketcherGui::ReleaseHandler(doc);
|
||||
|
||||
// Sync the FreeCAD selection with the selection in the ConstraintView widget
|
||||
if (didRelease) {
|
||||
if (didRelease && item) {
|
||||
Gui::Selection().clearSelection();
|
||||
std::string doc_name = static_cast<ConstraintItem*>(item)->sketchView->getSketchObject()->getDocument()->getName();
|
||||
std::string obj_name = static_cast<ConstraintItem*>(item)->sketchView->getSketchObject()->getNameInDocument();
|
||||
|
||||
Reference in New Issue
Block a user