issue error directly when doc is malformated

This should popup a message saying "No reader engine for this file"
instead of a crash when document file is malformated.

This should fix #868.
This commit is contained in:
chrox
2014-08-29 17:17:08 +08:00
parent 233f847954
commit 2f2d9f1bf7
6 changed files with 23 additions and 17 deletions

View File

@@ -11,8 +11,7 @@ function PicDocument:init()
if not pic then pic = require("ffi/pic") end
ok, self._document = pcall(pic.openDocument, self.file)
if not ok then
self.error_message = "failed to open jpeg image"
return
error("Failed to open jpeg image")
end
self.info.has_pages = true