From dba61da1bfb7e4d74c723f369d1c017df9707a14 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 8 Sep 2022 08:03:57 -0400 Subject: Create a special "destroyed" type rather than using null When a QPDF is destroyed, changing indirect objects to direct nulls makes them effectively disappear silently when they sneak into other places. Instead, we should treat this as an error. Adding a destroyed object type makes this possible. --- libqpdf/QPDF_Unresolved.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libqpdf/QPDF_Unresolved.cc') diff --git a/libqpdf/QPDF_Unresolved.cc b/libqpdf/QPDF_Unresolved.cc index 503e5b84..79553c1e 100644 --- a/libqpdf/QPDF_Unresolved.cc +++ b/libqpdf/QPDF_Unresolved.cc @@ -17,7 +17,7 @@ std::shared_ptr QPDF_Unresolved::shallowCopy() { throw std::logic_error( - "attempted to shallow copy unresolved QPDFObjectHandle"); + "attempted to shallow copy an unresolved QPDFObjectHandle"); return nullptr; } @@ -32,5 +32,7 @@ QPDF_Unresolved::unparse() JSON QPDF_Unresolved::getJSON(int json_version) { + throw std::logic_error( + "attempted to get JSON from an unresolved QPDFObjectHandle"); return JSON::makeNull(); } -- cgit v1.2.3-54-g00ecf