jfree / jfreesvg

A fast, lightweight Java library for creating Scalable Vector Graphics (SVG) output.
http://www.jfree.org/jfreesvg
GNU General Public License v3.0
319 stars 58 forks source link

drawImage method (Line 2520) perhaps needs a null check #6

Closed jsnoriegam closed 7 years ago

jsnoriegam commented 7 years ago

I'm using PDFBox > PDFRenderer.renderPageToGraphics to create an SVG from a PDF page and i was getting a NullPointerException every time, then, after a long backtrace i found this: drawImage(img, null, null) on their code, and i'm not really sure if the problem is in your code but this is what i found on the Java Specification:

(https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics2D.html)

If an AffineTransform is passed to drawImage(Image, AffineTransform, ImageObserver), the AffineTransform is used to transform the bounding box from image space to user space. If no AffineTransform is supplied, the bounding box is treated as if it is already in user space.

I'm guessing you need to do a null check on that method.

Thanks.

jfree commented 7 years ago

You are right! Thanks for the feedback. I just added a test that shows the NullPointerException, and now I will add the null check.

jfree commented 7 years ago

Done.