diff --git a/src/Imaging/JpegFile.cs b/src/Imaging/JpegFile.cs
index f341ee0..526bc25 100644
--- a/src/Imaging/JpegFile.cs
+++ b/src/Imaging/JpegFile.cs
@@ -275,10 +275,14 @@ namespace FSpot {
 #if USE_TIFF
 			try {
 				DirectoryEntry e = ExifHeader.Directory.Lookup (TagId.Orientation);
-				orientation = (PixbufOrientation)e.ValueAsLong [0];
+            if (e == null) { 
+              return orientation; 
+            }
+            orientation = (PixbufOrientation)e.ValueAsLong [0];
 			} catch {
 				Log.Warning ("Error checking orientation", uri);
 			}
+      
 #else						     
 Log.Debug (">>>");
 			Exif.ExifEntry e = this.ExifData.GetContents (Exif.Ifd.Zero).Lookup (Exif.Tag.Orientation);
