diff -up qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc.contents qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc --- qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc.contents 2020-01-17 12:54:04.170942606 +0100 +++ qpdf-5.0.1/libqpdf/QPDFObjectHandle.cc 2020-01-17 12:55:17.944246296 +0100 @@ -633,7 +633,7 @@ QPDFObjectHandle::getPageContents() { result.push_back(contents); } - else + else if (! contents.isNull()) { throw std::runtime_error("unknown object type inspecting /Contents " "key in page dictionary"); diff -up qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out.contents qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out --- qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out.contents 2020-01-17 12:54:04.170942606 +0100 +++ qpdf-5.0.1/qpdf/qtest/qpdf/page-no-content.out 2020-01-17 12:54:04.170942606 +0100 @@ -0,0 +1,8 @@ +page 1: 3 0 R + content: + 6 0 R +page 2: 4 0 R + content: +page 3: 5 0 R + content: + 9 0 R diff -up qpdf-5.0.1/qpdf/qtest/qpdf.test.contents qpdf-5.0.1/qpdf/qtest/qpdf.test --- qpdf-5.0.1/qpdf/qtest/qpdf.test.contents 2013-10-18 19:51:30.000000000 +0200 +++ qpdf-5.0.1/qpdf/qtest/qpdf.test 2020-01-17 12:54:04.171942598 +0100 @@ -199,7 +199,7 @@ $td->runtest("remove page we don't have" show_ntests(); # ---------- $td->notify("--- Miscellaneous Tests ---"); -$n_tests += 70; +$n_tests += 71; $td->runtest("qpdf version", {$td->COMMAND => "qpdf --version"}, @@ -545,6 +545,11 @@ $td->runtest("sanity check array size", $td->EXIT_STATUS => 2}, $td->NORMALIZE_NEWLINES); +$td->runtest("handle page no with contents", + {$td->COMMAND => "qpdf --show-pages page-no-content.pdf"}, + {$td->FILE => "page-no-content.out", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); + show_ntests(); # ---------- $td->notify("--- Numeric range parsing tests ---");