From 07bf84a1ab35cb026d57e56b061edf0cb334d66a Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 2 Jan 2009 09:08:22 +0000 Subject: Guard against invalid destinations. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@730682 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/pdf/PDFDocumentNavigationHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/java/org') diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java b/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java index d09957a39..2609b13ec 100644 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java @@ -86,8 +86,9 @@ public class PDFDocumentNavigationHandler implements IFDocumentNavigationHandler parent = getPDFDoc().getOutlineRoot(); } PDFAction action = getAction(bookmark.getAction()); + String actionRef = (action != null ? action.makeReference().toString() : null); PDFOutline pdfOutline = getPDFDoc().getFactory().makeOutline(parent, - bookmark.getTitle(), action.makeReference().toString(), bookmark.isShown()); + bookmark.getTitle(), actionRef, bookmark.isShown()); Iterator iter = bookmark.getChildBookmarks().iterator(); while (iter.hasNext()) { Bookmark b = (Bookmark)iter.next(); @@ -109,7 +110,9 @@ public class PDFDocumentNavigationHandler implements IFDocumentNavigationHandler //TODO Revisit when PDFLink is converted to a PDFDictionary PDFLink pdfLink = getPDFDoc().getFactory().makeLink( targetRect2D, pdfAction); - documentHandler.currentPage.addAnnotation(pdfLink); + if (pdfLink != null) { + documentHandler.currentPage.addAnnotation(pdfLink); + } } /** @@ -134,6 +137,9 @@ public class PDFDocumentNavigationHandler implements IFDocumentNavigationHandler } private PDFAction getAction(AbstractAction action) { + if (action == null) { + return null; + } PDFAction pdfAction = (PDFAction)this.completeActions.get(action.getID()); if (pdfAction != null) { return pdfAction; -- cgit v1.2.3