Skip to content

Commit

Permalink
Fix 2884 crash on page delete
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Feb 6, 2017
1 parent 86363ca commit 2c7afff
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Mod/TechDraw/App/DrawPage.cpp
Expand Up @@ -335,10 +335,12 @@ void DrawPage::unsetupObject()
}
Views.setValues(emptyViews);

//no template crash here?? if Template.getValue is null or invalid, this will fail.
std::string templateName = Template.getValue()->getNameInDocument();
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
docName.c_str(), templateName.c_str());
App::DocumentObject* tmp = Template.getValue();
if (tmp != nullptr) {
std::string templateName = Template.getValue()->getNameInDocument();
Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
docName.c_str(), templateName.c_str());
}
Template.setValue(nullptr);
}

Expand Down

0 comments on commit 2c7afff

Please sign in to comment.