From 12346a67efc1e1d4c6ca6e444542cdb5ddc3ca07 Mon Sep 17 00:00:00 2001 From: WandererFan Date: Wed, 1 Feb 2017 19:05:49 -0500 Subject: [PATCH] Fix 2884 crash on page delete --- src/Mod/TechDraw/App/DrawPage.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawPage.cpp b/src/Mod/TechDraw/App/DrawPage.cpp index 41462063f..f2177ce07 100644 --- a/src/Mod/TechDraw/App/DrawPage.cpp +++ b/src/Mod/TechDraw/App/DrawPage.cpp @@ -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); }