Skip to content

Commit

Permalink
patching PDFCore.py to properly check for ids in self.objects when re…
Browse files Browse the repository at this point in the history
…f JSObjects
  • Loading branch information
wroersma committed May 18, 2018
1 parent 8d6a370 commit 38b1554
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 18 additions & 10 deletions peepdf/PDFCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4323,16 +4323,24 @@ def updateObjects(self):
del(compressedObjectsDict)
for id in self.referencedJSObjects:
if id not in self.containingJS:
object = self.objects[id].getObject()
if object is None:
errorMessage = 'Object is None'
if isForceMode:
pdfFile.addError(errorMessage)
continue
else:
return (-1, errorMessage)
object.setReferencedJSObject(True)
self.updateStats(id, object)
if self.objects:
if str(id) in self.objects:
errorMessage = 'Object is None'
if isForceMode:
pdfFile.addError(errorMessage)
continue
else:
object = self.objects[str(id)].getObject()
if object:
errorMessage = 'Object is None'
if isForceMode:
pdfFile.addError("TEST")
pdfFile.addError(errorMessage)
continue
else:
return (-1, errorMessage)
object.setReferencedJSObject(True)
self.updateStats(id, object)
if errorMessage != '':
return (-1, errorMessage)
return (0, '')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="peepdf",
version="0.4.1",
version="0.4.2",
author="Jose Miguel Esparza",
license="GNU GPLv3",
url="http://eternal-todo.com",
Expand Down

0 comments on commit 38b1554

Please sign in to comment.