Skip to content

Commit

Permalink
Merge pull request #331 from veraPDF/null_pointer
Browse files Browse the repository at this point in the history
Fix NullPointerException in getParentLang in PBoxPDStructElem
  • Loading branch information
MaximPlusov authored and Git User committed Nov 9, 2023
1 parent 67d5625 commit 10bc7a5
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,18 @@ public String getstandardType() {

@Override
public String getparentLang() {
COSString baseLang = null;
Set<COSObjectKey> keys = new HashSet<>();
COSObjectKey key;
COSDictionary parentDict = (COSDictionary)((COSDictionary) this.simplePDObject).getDictionaryObject(COSName.P);
if (parentDict == null) {
return null;
}
PDStructureNode structureParent = PDStructureNode.create(parentDict);
PDStructureElement parent = null;
if (structureParent instanceof PDStructureElement) {
parent = (PDStructureElement) structureParent;
}
COSString baseLang = null;
Set<COSObjectKey> keys = new HashSet<>();
COSObjectKey key;
while (baseLang == null && parent != null) {
key = parent.getCOSObject().getKey();
if (keys.contains(key)){
Expand Down

0 comments on commit 10bc7a5

Please sign in to comment.