mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 02:54:46 -04:00
prevent crash is something goes wrong processing a PDF in OSX
This commit is contained in:
@ -97,6 +97,15 @@ QImage MacOSXPDFComic::getPage(const int pageNum)
|
||||
|
||||
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);
|
||||
|
||||
qtImage = QImage(bytes, pageRect.size.width, pageRect.size.height, QImage::Format_ARGB32);
|
||||
|
Reference in New Issue
Block a user