Fix leaking file object when loading non-blend file

This commit is contained in:
Sybren A. Stüvel
2018-02-23 14:26:57 +01:00
parent 8e0b135eb3
commit eb8281ea82
2 changed files with 10 additions and 1 deletions
@@ -94,6 +94,7 @@ class BlendFile:
fileobj.close()
self.fileobj = tmpfile
elif magic != BLENDFILE_MAGIC:
fileobj.close()
raise exceptions.BlendFileError("File is not a blend file", path)
self.header = header.BlendFileHeader(self.fileobj, self.raw_filepath)