diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-01-02 09:08:22 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-01-02 09:08:22 +0000 |
commit | 07bf84a1ab35cb026d57e56b061edf0cb334d66a (patch) | |
tree | 69597a8127e9e2cbf51180c2aef5c36009101ac9 /src/java/org | |
parent | 45ff1920e231e991b667712983c6f1523d7a5179 (diff) | |
download | xmlgraphics-fop-07bf84a1ab35cb026d57e56b061edf0cb334d66a.tar.gz xmlgraphics-fop-07bf84a1ab35cb026d57e56b061edf0cb334d66a.zip |
Guard against invalid destinations.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@730682 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java | 10 |
1 files changed, 8 insertions, 2 deletions
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; |