diff --git a/coders/tiff.c b/coders/tiff.c
index cdfcbb4..612b1bd 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -627,10 +627,10 @@
   /*
     Read EXIF properties.
   */
+  offset=0;
   if (TIFFGetField(tiff,TIFFTAG_EXIFIFD,&offset) == 0)
     return;
   directory=TIFFCurrentDirectory(tiff);
-  offset=0;
   if (TIFFReadEXIFDirectory(tiff,offset) == 0)
     return;
   sans=NULL;