fixes FreeCAD segfaults when pressing 'Clear All' in Measure tasks dialogue with no opened document

This commit is contained in:
wmayer
2019-03-10 12:27:20 +01:00
parent c1c5dd9bb4
commit 3e713d918c

View File

@@ -204,8 +204,10 @@ void PartGui::dumpLinearResults(const BRepExtrema_DistShapeShape &measure)
Gui::View3DInventorViewer * PartGui::getViewer()
{
Gui::View3DInventor *view = dynamic_cast<Gui::View3DInventor*>(Gui::Application::Instance->
activeDocument()->getActiveView());
Gui::Document *doc = Gui::Application::Instance->activeDocument();
if (!doc)
return 0;
Gui::View3DInventor *view = dynamic_cast<Gui::View3DInventor*>(doc->getActiveView());
if (!view)
return 0;
Gui::View3DInventorViewer *viewer = view->getViewer();
@@ -255,8 +257,10 @@ SoNode* PartGui::createLinearDimension(const gp_Pnt &point1, const gp_Pnt &point
void PartGui::eraseAllDimensions()
{
Gui::View3DInventor *view = dynamic_cast<Gui::View3DInventor*>(Gui::Application::Instance->
activeDocument()->getActiveView());
Gui::Document *doc = Gui::Application::Instance->activeDocument();
if (!doc)
return;
Gui::View3DInventor *view = dynamic_cast<Gui::View3DInventor*>(doc->getActiveView());
if (!view)
return;
Gui::View3DInventorViewer *viewer = view->getViewer();