Prevent crash when no document open

This commit is contained in:
WandererFan 2016-12-02 11:23:10 -05:00 committed by wmayer
parent 83ce64a1d3
commit 065156eed5

View File

@ -449,6 +449,9 @@ QString TaskProjGroup::formatVector(Base::Vector3d v)
bool TaskProjGroup::accept() bool TaskProjGroup::accept()
{ {
Gui::Document* doc = Gui::Application::Instance->getDocument(multiView->getDocument());
if (!doc) return false;
Gui::Command::commitCommand(); Gui::Command::commitCommand();
Gui::Command::updateActive(); Gui::Command::updateActive();
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()"); Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
@ -458,6 +461,9 @@ bool TaskProjGroup::accept()
bool TaskProjGroup::reject() bool TaskProjGroup::reject()
{ {
Gui::Document* doc = Gui::Application::Instance->getDocument(multiView->getDocument());
if (!doc) return false;
if (getCreateMode()) { if (getCreateMode()) {
std::string multiViewName = multiView->getNameInDocument(); std::string multiViewName = multiView->getNameInDocument();
std::string PageName = multiView->findParentPage()->getNameInDocument(); std::string PageName = multiView->findParentPage()->getNameInDocument();