f-spot r4311 - in trunk: . src



Author: lmilesi
Date: Wed Sep  3 12:02:55 2008
New Revision: 4311
URL: http://svn.gnome.org/viewvc/f-spot?rev=4311&view=rev

Log:
2008-09-03  Lorenzo Milesi <maxxer yetopen it>

	* src/PrintOperation.cs: avoid crashing if image is not found on
	filesystem. Fix bgo#547663.



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

Modified: trunk/src/PrintOperation.cs
==============================================================================
--- trunk/src/PrintOperation.cs	(original)
+++ trunk/src/PrintOperation.cs	Wed Sep  3 12:02:55 2008
@@ -14,6 +14,7 @@
 using Mono.Unix;
 
 using FSpot.Widgets;
+using FSpot.Utils;
 
 namespace FSpot
 {
@@ -103,7 +104,16 @@
 						continue;
 					using (ImageFile img = new ImageFile (selected_photos[p_index].DefaultVersionUri))
 					{
-						Gdk.Pixbuf pixbuf = img.Load ();
+						Gdk.Pixbuf pixbuf;
+						try {
+							pixbuf = img.Load ();
+						} catch (Exception e) {
+							Log.Exception ("Unable to load image " + selected_photos[p_index].DefaultVersionUri + "\n", e);
+							// If the image is not found load error pixbuf
+							pixbuf = new Gdk.Pixbuf (PixbufUtils.ErrorPixbuf, 0, 0, 
+										      PixbufUtils.ErrorPixbuf.Width, 
+										      PixbufUtils.ErrorPixbuf.Height);
+						}
 						//Gdk.Pixbuf pixbuf = img.Load (100, 100);
 						bool rotated = false;
 						if (Math.Sign ((double)pixbuf.Width/pixbuf.Height - 1.0) != Math.Sign (w/h - 1.0)) {



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