mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
prevent crash is something goes wrong processing a PDF in OSX
This commit is contained in:
parent
7fe2ad526b
commit
71ba1de373
@ -97,6 +97,15 @@ QImage MacOSXPDFComic::getPage(const int pageNum)
|
|||||||
|
|
||||||
lastPageData = (void *)dataRef;
|
lastPageData = (void *)dataRef;
|
||||||
|
|
||||||
|
if(!lastPageData)
|
||||||
|
{
|
||||||
|
QLOG_ERROR() << "Unable to extract image from PDF file using CGPDFDocument";
|
||||||
|
CGImageRelease(image);
|
||||||
|
CGContextRelease(bitmapContext);
|
||||||
|
CGColorSpaceRelease(genericColorSpace);
|
||||||
|
return QImage();
|
||||||
|
}
|
||||||
|
|
||||||
const uchar *bytes = (const uchar *)CFDataGetBytePtr(dataRef);
|
const uchar *bytes = (const uchar *)CFDataGetBytePtr(dataRef);
|
||||||
|
|
||||||
qtImage = QImage(bytes, pageRect.size.width, pageRect.size.height, QImage::Format_ARGB32);
|
qtImage = QImage(bytes, pageRect.size.width, pageRect.size.height, QImage::Format_ARGB32);
|
||||||
|
Loading…
Reference in New Issue
Block a user