Add a couple of checks that handles are valid

This commit is contained in:
Veronica K. B. Olsen
2020-05-30 14:56:06 +02:00
parent 7084367919
commit 25aedc398b
+7 -1
View File
@@ -71,6 +71,9 @@ class NWDoc():
"""Open a document from handle, capturing potential file system
errors and parse meta data.
"""
if not isHandle(tHandle):
return None
# Always clear first, since the object will often be reused.
self.clearDocument()
@@ -170,7 +173,10 @@ class NWDoc():
"""Permanently delete a document source file and its backups
from the project data folder.
"""
docFile = self.docHandle+".nwd"
if not isHandle(tHandle):
return False
docFile = tHandle+".nwd"
chkList = []
chkList.append(path.join(self.theProject.projContent, docFile))