aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFPageObjectHelper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDFPageObjectHelper.cc')
-rw-r--r--libqpdf/QPDFPageObjectHelper.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc
index e9e09d73..4093622d 100644
--- a/libqpdf/QPDFPageObjectHelper.cc
+++ b/libqpdf/QPDFPageObjectHelper.cc
@@ -122,7 +122,17 @@ void
QPDFPageObjectHelper::removeUnreferencedResources()
{
NameWatcher nw;
- filterPageContents(&nw);
+ try
+ {
+ filterPageContents(&nw);
+ }
+ catch (std::exception& e)
+ {
+ this->oh.warnIfPossible(
+ std::string("Unable to parse content stream: ") + e.what() +
+ "; not attempting to remove unreferenced objects from this page");
+ return;
+ }
// Walk through /Font and /XObject dictionaries, removing any
// resources that are not referenced. We must make copies of
// resource dictionaries down into the dictionaries are mutating