jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.34k stars 787 forks source link

UnicodeTranslatorFromDescriptor can return nil #128

Closed flibustenet closed 7 years ago

flibustenet commented 7 years ago

Hi,

In the doc of UnicodeTranslatorFromDescriptor it says:

// If an error occurs reading the descriptor, the returned function is valid // but does not perform any rune translation.

But if the pdf is in error it return nil if f.err != nil { return } which panic if we use this nil function of course.

Is it a mistake ?

jung-kurt commented 7 years ago

Good catch, @flibustenet. Corrected in ef5029596657de75a312ed095fd29ec7aacee058

flibustenet commented 7 years ago

I had a bug report at 17:20, 20 minutes after i could see from where it come thanks to clearness of Go and 2 hours after you corrected it on the other side of the ocean for all the community. It's amazing. Thanks

jung-kurt commented 7 years ago

Your identification of the problematic code made the solution easy!

Wonderful pictures of bicycling through France. Delightful.