From 2ff12af50cd9713aa39de9ca410778eb2fad88bb Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 23 Oct 2014 09:01:10 +0800 Subject: [PATCH] protected call of mupdf.renderImage --- frontend/document/credocument.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/document/credocument.lua b/frontend/document/credocument.lua index 5d77ff10f..bae09b6ad 100644 --- a/frontend/document/credocument.lua +++ b/frontend/document/credocument.lua @@ -148,9 +148,11 @@ function CreDocument:getCoverPageImage() local data, size = self._document:getCoverPageImageData() if data and size then local Mupdf = require("ffi/mupdf") - local image = Mupdf.renderImage(data, size) - ffi.C.free(data) - return image + local ok, image = pcall(Mupdf.renderImage, data, size) + if ok then + ffi.C.free(data) + return image + end end end