diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx index 31cf0e0796..113aed9b53 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx +++ b/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); + } } ////////////////////////////////////////////////////////////////////