From a6e29e32aeccec7ce71f045fbed00c68671aec32 Mon Sep 17 00:00:00 2001 From: Andreas Brinner Date: Wed, 9 Dec 2020 11:21:59 +0100 Subject: [PATCH] Check return value of getMDIViewPage() a second time When exporting a hidden TechDraw::Page with exportPageAs[Pdf|SVG] a Segmentation Fault occured. The return value of getMDIViewPage() was only checked for the first call, but not for the second call. showMDIViewPage() silently returns, when the TechDraw::Page is hidden and does not load the page. --- src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp index c15f0ec13c..14dc2882c3 100644 --- a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp +++ b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp @@ -193,7 +193,11 @@ private: } else { vpp->showMDIViewPage(); mdi = vpp->getMDIViewPage(); - mdi->printPdf(filePath); + if (mdi) { + mdi->printPdf(filePath); + } else { + throw Py::TypeError("Page not available! Is it Hidden?"); + } } } } @@ -234,7 +238,11 @@ private: } else { vpp->showMDIViewPage(); mdi = vpp->getMDIViewPage(); - mdi->saveSVG(filePath); + if (mdi) { + mdi->saveSVG(filePath); + } else { + throw Py::TypeError("Page not available! Is it Hidden?"); + } } } }