Skip to content

Commit

Permalink
Merge pull request #601 from veraPDF/parent_elem
Browse files Browse the repository at this point in the history
Fix getParentStructElem methods
  • Loading branch information
MaximPlusov authored Oct 30, 2023
2 parents 580f59e + b5dbaa6 commit 7a1b934
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ private COSObject getParentStructElem(StructureElementAccessObject structureElem
if (structTreeRoot != null) {
PDNumberTreeNode parentTreeRoot = structTreeRoot.getParentTree();
COSObject structureElement = parentTreeRoot == null ? null : structureElementAccessObject.getStructureElement(parentTreeRoot, mcid);
if (structureElement != null && !structureElement.empty()) {
if (structureElement != null && !structureElement.empty() && structureElement.getType() != COSObjType.COS_NULL) {
return structureElement;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.verapdf.as.ASAtom;
import org.verapdf.cos.COSBase;
import org.verapdf.cos.COSKey;
import org.verapdf.cos.COSObjType;
import org.verapdf.cos.COSObject;
import org.verapdf.exceptions.LoopedException;
import org.verapdf.gf.model.impl.pd.util.PDResourcesHandler;
Expand Down Expand Up @@ -80,7 +81,7 @@ private COSObject getStructElem() {
if (structTreeRoot != null && mcid != null) {
PDNumberTreeNode parentTreeRoot = structTreeRoot.getParentTree();
COSObject structureElement = parentTreeRoot == null ? null : structureElementAccessObject.getStructureElement(parentTreeRoot, mcid);
if (structureElement != null && !structureElement.empty()) {
if (structureElement != null && !structureElement.empty() && structureElement.getType() != COSObjType.COS_NULL) {
return structureElement;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private COSObject getParentStructureElem(StructureElementAccessObject structureE
if (structTreeRoot != null) {
PDNumberTreeNode parentTreeRoot = structTreeRoot.getParentTree();
COSObject structureElement = parentTreeRoot == null ? null : structureElementAccessObject.getStructureElement(parentTreeRoot, null);
if (structureElement != null && !structureElement.empty()) {
if (structureElement != null && !structureElement.empty() && structureElement.getType() != COSObjType.COS_NULL) {
return structureElement;
}
}
Expand Down

0 comments on commit 7a1b934

Please sign in to comment.