Description: Avoid NullPointerException
 at com.lowagie.text.pdf.PRIndirectReference.toPdf
Author: Robin Houston <robin@mysociety.org>
Bug-GitHub: https://github.com/robinhouston/pdftk/issues/2
Origin: https://github.com/robinhouston/pdftk/commit/43f936c6244b7a06bb99913fc97b991b70bdc21d


--- a/java/com/lowagie/text/pdf/PdfWriter.java
+++ b/java/com/lowagie/text/pdf/PdfWriter.java
@@ -555,7 +555,7 @@
          */
         public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
             os.write(getISOBytes("trailer\n")); // ssteward: 1.44 - preserve newline after trailer
-            super.toPdf(null, os);
+            super.toPdf(writer, os);
             os.write(getISOBytes("\nstartxref\n"));
             os.write(getISOBytes(String.valueOf(offset)));
             os.write(getISOBytes("\n%%EOF\n"));
