Author: jeremias
Date: Fri Jan  2 01:08:22 2009
New Revision: 730682

URL: http://svn.apache.org/viewvc?rev=730682&view=rev
Log:
Guard against invalid destinations.

Modified:
    
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java

Modified: 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java?rev=730682&r1=730681&r2=730682&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java
 Fri Jan  2 01:08:22 2009
@@ -86,8 +86,9 @@
             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 @@
         //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 @@
     }
 
     private PDFAction getAction(AbstractAction action) {
+        if (action == null) {
+            return null;
+        }
         PDFAction pdfAction = 
(PDFAction)this.completeActions.get(action.getID());
         if (pdfAction != null) {
             return pdfAction;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to