diff --git a/src/PIL/VtfImagePlugin.py b/src/PIL/VtfImagePlugin.py index fc190f850..017eee747 100644 --- a/src/PIL/VtfImagePlugin.py +++ b/src/PIL/VtfImagePlugin.py @@ -184,6 +184,7 @@ class VtfImageFile(ImageFile.ImageFile): format_description = "Valve Texture Format" def _open(self): + assert self.fp is not None if not _accept(self.fp.read(12)): msg = "not a VTF file" raise SyntaxError(msg)