f-spot r4699 - in trunk: . src



Author: sdelcroix
Date: Mon Jan 19 09:18:45 2009
New Revision: 4699
URL: http://svn.gnome.org/viewvc/f-spot?rev=4699&view=rev

Log:
2008-01-16  Stephane Delcroix  <sdelcroix novell com>

	* src/PixbufUtils.cs: add a check for corrupted ExifData. Fixes
	bnc #448019.

Modified:
   trunk/ChangeLog
   trunk/src/PixbufUtils.cs

Modified: trunk/src/PixbufUtils.cs
==============================================================================
--- trunk/src/PixbufUtils.cs	(original)
+++ trunk/src/PixbufUtils.cs	Mon Jan 19 09:18:45 2009
@@ -514,24 +514,29 @@
 		// The DCF spec says thumbnails should be 160x120 always
 		Pixbuf thumbnail = ScaleToAspect (pixbuf, 160, 120);
 		byte [] thumb_data = Save (thumbnail, "jpeg", null, null);
-		exif_data.Data = thumb_data;
 		thumbnail.Dispose ();
 
-		// Most of the things we will set will be in the 0th ifd
-		Exif.ExifContent content = exif_data.GetContents (Exif.Ifd.Zero);
+		byte [] data = new byte [0]; 
+		FPixbufJpegMarker [] marker = new FPixbufJpegMarker [0];
+		bool result = false;
 
-		// reset the orientation tag the default is top/left
-		content.GetEntry (Exif.Tag.Orientation).Reset ();
+		if (exif_data != null && exif_data.Handle.Handle != IntPtr.Zero) {
+			exif_data.Data = thumb_data;
 
-		// set the write time in the datetime tag
-		content.GetEntry (Exif.Tag.DateTime).Reset ();
+			// Most of the things we will set will be in the 0th ifd
+			Exif.ExifContent content = exif_data.GetContents (Exif.Ifd.Zero);
 
-		// set the software tag
-		content.GetEntry (Exif.Tag.Software).SetData (FSpot.Defines.PACKAGE + " version " + FSpot.Defines.VERSION);
+			// reset the orientation tag the default is top/left
+			content.GetEntry (Exif.Tag.Orientation).Reset ();
 
-		byte [] data = exif_data.Save ();
-		FPixbufJpegMarker [] marker = new FPixbufJpegMarker [0];
-		bool result = false;
+			// set the write time in the datetime tag
+			content.GetEntry (Exif.Tag.DateTime).Reset ();
+
+			// set the software tag
+			content.GetEntry (Exif.Tag.Software).SetData (FSpot.Defines.PACKAGE + " version " + FSpot.Defines.VERSION);
+
+			data = exif_data.Save ();
+		}
 
 		unsafe {
 			if (data.Length > 0) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]