From: Jeremias Maerki Date: Wed, 12 Mar 2003 08:02:05 +0000 (+0000) Subject: Fix NPE when content of an element is empty. X-Git-Tag: Alt-Design-integration-base~38 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=472fe8a63c528babc06ff275253b5bf625ec1cf4;p=xmlgraphics-fop.git Fix NPE when content of an element is empty. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196072 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 64fbdcfe9..241f0a316 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -312,14 +312,16 @@ public class PDFGraphics2D extends AbstractGraphics2D { AffineTransform at = getTransform(); Shape b = at.createTransformedShape(bounds); b = trans.createTransformedShape(b); - Rectangle rect = b.getBounds(); - - if (linkType != PDFLink.EXTERNAL) { - String pdfdest = "/FitR " + dest; - resourceContext.addAnnotation(pdfDoc.makeLink(rect, pageRef, pdfdest)); - } else { - resourceContext.addAnnotation(pdfDoc.makeLink(rect, - dest, linkType, 0)); + if (b != null) { + Rectangle rect = b.getBounds(); + + if (linkType != PDFLink.EXTERNAL) { + String pdfdest = "/FitR " + dest; + resourceContext.addAnnotation(pdfDoc.makeLink(rect, pageRef, pdfdest)); + } else { + resourceContext.addAnnotation(pdfDoc.makeLink(rect, + dest, linkType, 0)); + } } }