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.
This commit is contained in:
Andreas Brinner
2020-12-09 11:21:59 +01:00
parent 065f3fafa9
commit a6e29e32ae

View File

@@ -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?");
}
}
}
}