[TD]fix crash on Section apply

This commit is contained in:
WandererFan
2020-01-15 22:52:00 -05:00
committed by WandererFan
parent 96ad0d9f37
commit 1665aee5a3

View File

@@ -277,19 +277,23 @@ void TaskSectionView::onApplyClicked(bool b)
bool TaskSectionView::apply(void)
{
// Base::Console().Message("TSV::apply() - m_dirName: %s\n", m_dirName.c_str());
if (m_dirName.empty()) {
std::string msg = Base::Tools::toStdString(tr("TaskSectionView::apply - No section direction picked yet"));
Base::Console().Error((msg + "\n").c_str());
return false;
}
if (m_section == nullptr) {
return false;
}
App::Document* doc = m_section->getDocument();
App::DocumentObject* baseObj = doc->getObject(m_saveBaseName.c_str());
TechDraw::DrawViewPart* dvp = dynamic_cast<TechDraw::DrawViewPart*>(baseObj);
if (dvp == nullptr) {
return false;
}
if (m_dirName.empty()) {
std::string msg = Base::Tools::toStdString(tr("TSV::apply - No section direction picked yet"));
Base::Console().Error((msg + "\n").c_str());
} else {
checkAll(false);
applyQuick(m_dirName);
}
checkAll(false);
applyQuick(m_dirName);
return true;
}