diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-11-29 13:31:05 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-11-29 13:42:36 +0100 |
commit | 720ce9e8f333ba3911fa8003f08fd8813c19181a (patch) | |
tree | 158d7a6c4030f5b468c99f39b875cc1aaadd9c4c /qpdf | |
parent | ac17308cf6cd6ea51cfbffdc898f0b67c89ae388 (diff) | |
download | qpdf-720ce9e8f333ba3911fa8003f08fd8813c19181a.tar.zst |
Improve testing and error handling around operating before processing
Diffstat (limited to 'qpdf')
-rw-r--r-- | qpdf/qtest/qpdf/test73.out | 3 | ||||
-rw-r--r-- | qpdf/test_driver.cc | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/qpdf/qtest/qpdf/test73.out b/qpdf/qtest/qpdf/test73.out index 435189fd..b23c4c00 100644 --- a/qpdf/qtest/qpdf/test73.out +++ b/qpdf/qtest/qpdf/test73.out @@ -1,2 +1,3 @@ -WARNING: closed input source: object 1/0: error reading object: QPDF operation attempted after closing input source +getRoot: attempted to dereference an uninitialized QPDFObjectHandle +WARNING: closed input source: object 1/0: error reading object: QPDF operation attempted on a QPDF object with no input source. QPDF operations are invalid before processFile (or another process method) or after closeInputSource closed input source: unable to find /Root dictionary diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 1d995bb7..7d5b2ece 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -2715,6 +2715,16 @@ void runtest(int n, char const* filename1, char const* arg2) } else if (n == 73) { + try + { + QPDF pdf2; + pdf2.getRoot(); + } + catch (std::exception& e) + { + std::cerr << "getRoot: " << e.what() << std::endl; + } + pdf.closeInputSource(); pdf.getRoot().getKey("/Pages").unparseResolved(); } |