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.31k stars 777 forks source link

AddUTF8Font panics with file not found #251

Closed ajstarks closed 5 years ago

ajstarks commented 5 years ago

If the file cannot be found, AddUTF8Font panics instead of returning an error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x525b45]

goroutine 1 [running]:
github.com/jung-kurt/gofpdf.(*Fpdf).addFont(0xc0000e2000, 0x5a46eb, 0x4, 0x0, 0x0, 0xc00007e060, 0x53, 0x1)
    /home/ajstarks/gowork/src/github.com/jung-kurt/gofpdf/fpdf.go:1603 +0x4c5
github.com/jung-kurt/gofpdf.(*Fpdf).AddUTF8Font(...)
    /home/ajstarks/gowork/src/github.com/jung-kurt/gofpdf/fpdf.go:1585
main.main()
    /home/ajstarks/work/utftest.go:26 +0x260
exit status 2
jung-kurt commented 5 years ago

Thanks for the report, @ajstarks. I'll look into it.

jung-kurt commented 5 years ago

Should be fixed with 641cda87ac3cf98cf58400cb3ce7513b6cc74295. Please reopen if this is still a problem.

ajstarks commented 5 years ago

confirmed fixed. thanks.