[Banshee-List] Exception handle patch - Commitable



Title: Exception handle patch - Commitable

Index: src/LibraryTransactions.cs
===================================================================
RCS file: /cvs/gnome/banshee/src/LibraryTransactions.cs,v
retrieving revision 1.25
diff -u -r1.25 LibraryTransactions.cs
--- src/LibraryTransactions.cs	9 Nov 2005 20:14:23 -0000	1.25
+++ src/LibraryTransactions.cs	9 Nov 2005 20:33:06 -0000
@@ -709,11 +709,17 @@
 				+ new Where("PlaylistId", Op.EqualTo, id);
 			IDataReader reader = Core.Library.Db.Query(query);
 			while(reader.Read() && !cancelRequested) {
-				DateTime startStamp = DateTime.Now;
-				int tid = Convert.ToInt32(reader[0]);
-				TrackInfo ti = Core.Library.Tracks[tid] as TrackInfo;
-				RaiseTrackInfo(ti);
-				UpdateAverageDuration(startStamp);
+				try {
+					DateTime startStamp = DateTime.Now;
+					int tid = Convert.ToInt32(reader[0]);
+					TrackInfo ti = Core.Library.Tracks[tid] as TrackInfo;
+					RaiseTrackInfo(ti);
+					UpdateAverageDuration(startStamp);
+				} catch(Exception e) {
+					//The Catalog must be updated with a new warning "The track is either blocked by query filter or removed from library."
+					Core.Log.PushWarning(Catalog.GetString("Could not load track from library"),
+					("The reason is: " + e.Message ),false);
+				}
 			}
 		}
 		


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