diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-04 17:50:02 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-04 17:55:42 +0100 |
commit | 837dcf8fc2546a80f205a0c4c53e5a1545c53a84 (patch) | |
tree | 8c21738d5bb958faadb36ffdaff3f4dbc82cbb35 /libqpdf/QPDF_optimization.cc | |
parent | a01359189b32c60c2d55b039f7aefd6c3ce0ebde (diff) | |
download | qpdf-837dcf8fc2546a80f205a0c4c53e5a1545c53a84.tar.zst |
Don't call assert while checking linearization data (fixes #209, #231)
Instead of calling assert for problems found during checking
linearization data, throw an exception which is later caught and
issued as an error. Ideally we would handle errors more robustly, but
this is still a significant improvement.
Diffstat (limited to 'libqpdf/QPDF_optimization.cc')
-rw-r--r-- | libqpdf/QPDF_optimization.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc index 1e42865c..59a01ea3 100644 --- a/libqpdf/QPDF_optimization.cc +++ b/libqpdf/QPDF_optimization.cc @@ -163,7 +163,12 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) pushInheritedAttributesToPageInternal( this->m->trailer.getKey("/Root").getKey("/Pages"), key_ancestors, this->m->all_pages, allow_changes, warn_skipped_keys); - assert(key_ancestors.empty()); + if (! key_ancestors.empty()) + { + throw std::logic_error( + "key_ancestors not empty after" + " pushing inherited attributes to pages"); + } this->m->pushed_inherited_attributes_to_pages = true; } |