Commit 0765872295e581ea6ae5a07e12916a552a1543ee
1 parent
0a52e60e
Form field for non-widget just returns null
Showing
2 changed files
with
4 additions
and
6 deletions
include/qpdf/QPDFAcroFormDocumentHelper.hh
| ... | ... | @@ -134,8 +134,8 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper |
| 134 | 134 | // field dictionary, the underlying object will be the same, but |
| 135 | 135 | // this is not always the case. Note that if you call this method |
| 136 | 136 | // with an annotation that is not a widget annotation, there will |
| 137 | - // not be an associated field, and this method will raise an | |
| 138 | - // exception. | |
| 137 | + // not be an associated field, and this method will return a | |
| 138 | + // helper associated with a null object (isNull() == true). | |
| 139 | 139 | QPDF_DLL |
| 140 | 140 | QPDFFormFieldObjectHelper |
| 141 | 141 | getFieldForAnnotation(QPDFAnnotationObjectHelper); | ... | ... |
libqpdf/QPDFAcroFormDocumentHelper.cc
| ... | ... | @@ -70,16 +70,14 @@ QPDFFormFieldObjectHelper |
| 70 | 70 | QPDFAcroFormDocumentHelper::getFieldForAnnotation(QPDFAnnotationObjectHelper h) |
| 71 | 71 | { |
| 72 | 72 | QPDFObjectHandle oh = h.getObjectHandle(); |
| 73 | + QPDFFormFieldObjectHelper result(QPDFObjectHandle::newNull()); | |
| 73 | 74 | if (! (oh.isDictionary() && |
| 74 | 75 | oh.getKey("/Subtype").isName() && |
| 75 | 76 | (oh.getKey("/Subtype").getName() == "/Widget"))) |
| 76 | 77 | { |
| 77 | - throw std::logic_error( | |
| 78 | - "QPDFAnnotationObjectHelper::getFieldForAnnotation called for" | |
| 79 | - " non-/Widget annotation"); | |
| 78 | + return result; | |
| 80 | 79 | } |
| 81 | 80 | analyze(); |
| 82 | - QPDFFormFieldObjectHelper result(QPDFObjectHandle::newNull()); | |
| 83 | 81 | QPDFObjGen og(oh.getObjGen()); |
| 84 | 82 | if (this->m->annotation_to_field.count(og)) |
| 85 | 83 | { | ... | ... |