Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Commit

Permalink
Workaround for possible panic from jpeg encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Jul 22, 2017
1 parent 3987c3a commit 7fbe49f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion book.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ type Book struct {
}

// NewBookFromFile creates a book object from a file
func NewBookFromFile(path, coverpath string) (*Book, error) {
func NewBookFromFile(path, coverpath string) (bk *Book, err error) {
defer func() {
if r := recover(); r != nil {
bk = nil
err = fmt.Errorf("Unknown error parsing book. Skipping. Error: %s", r)
}
}()

book := new(Book)
book.Title = filepath.Base(path)
book.Filepath = path
Expand Down

0 comments on commit 7fbe49f

Please sign in to comment.