Browse Source

don't crash on invalid tiff

David Rose 21 years ago
parent
commit
024da67802
1 changed files with 3 additions and 1 deletions
  1. 3 1
      panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx

+ 3 - 1
panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx

@@ -513,7 +513,9 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) :
 ////////////////////////////////////////////////////////////////////
 PNMFileTypeTIFF::Reader::
 ~Reader() {
-  TIFFClose( tif );
+  if (tif != (struct tiff *)NULL) {
+    TIFFClose(tif);
+  }
 }
 
 ////////////////////////////////////////////////////////////////////