Skip to content

Commit

Permalink
fixed crash with bokkmarks without edstination
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanpas committed Oct 10, 2018
1 parent cb2c449 commit bde5536
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>yanpas</groupId>
<artifactId>pdfmerger</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/yanpas/pdfmerger/Merger.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline;
import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem;

class Merger implements AutoCloseable {
final class Merger implements AutoCloseable {
private Deque<PDDocument> inDocuments = new ArrayDeque<>();
private int outPagesN = 0;
private PDDocumentOutline outOutline = new PDDocumentOutline();
Expand All @@ -20,7 +20,10 @@ private void addOutlines(Iterable<PDOutlineItem> itemCollection, PDOutlineItem r
throws IOException {
for (PDOutlineItem item : itemCollection) {
PDPage destPage = null;
destPage = item.findDestinationPage(inDoc);
try {
destPage = item.findDestinationPage(inDoc);
} catch (IOException e) {
}
PDOutlineItem outItem = new PDOutlineItem();
if (destPage != null) {
PDPage itemDestPage = outDocument.getPages().get(inDoc.getPages().indexOf(destPage) + outPagesN);
Expand Down

0 comments on commit bde5536

Please sign in to comment.