[f-spot] Handle exception when adding an CMS Profile



commit bdc3457705adb33f0eab929314078bb3b0207c91
Author: Stephen Shaw <sshaw decriptor com>
Date:   Fri Sep 7 23:10:06 2012 -0700

    Handle exception when adding an CMS Profile
    
    Before an CmsException was throw when the file
    wasn't good and we weren't handling it.

 src/Clients/MainApp/FSpot/ColorManagement.cs |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot/ColorManagement.cs b/src/Clients/MainApp/FSpot/ColorManagement.cs
index 8f22bef..d530ab8 100644
--- a/src/Clients/MainApp/FSpot/ColorManagement.cs
+++ b/src/Clients/MainApp/FSpot/ColorManagement.cs
@@ -77,15 +77,28 @@ namespace FSpot {
 			if (Directory.Exists (path)) {
 				string[] IccColorProfilList = System.IO.Directory.GetFiles (path, "*.icc");
 				foreach (string ColorProfilePath in IccColorProfilList) {
-					Cms.Profile profile = new Cms.Profile (ColorProfilePath);
-					if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey (profile.ProductDescription))
-						profs.Add(profile.ProductDescription, profile);
+					try {
+						Cms.Profile profile = new Cms.Profile (ColorProfilePath);
+					
+						if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey (profile.ProductDescription))
+							profs.Add(profile.ProductDescription, profile);
+					}
+					catch (Cms.CmsException CmsEx)
+					{
+						Console.WriteLine(CmsEx);
+					}
 				}
 				string[] IcmColorProfilList = System.IO.Directory.GetFiles (path, "*.icm");
 				foreach (string ColorProfilePath in IcmColorProfilList) {
-					Cms.Profile profile = new Cms.Profile (ColorProfilePath);
-					if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey (profile.ProductDescription))
-						profs.Add(profile.ProductDescription, profile);
+					try {
+						Cms.Profile profile = new Cms.Profile (ColorProfilePath);
+						if ((Cms.IccColorSpace)profile.ColorSpace == Cms.IccColorSpace.Rgb && profile.ProductDescription != null && !profs.ContainsKey (profile.ProductDescription))
+							profs.Add(profile.ProductDescription, profile);
+					}
+					catch (Cms.CmsException CmsEx)
+					{
+						Console.WriteLine(CmsEx);
+					}
 				}
 				string[] DirList = System.IO.Directory.GetDirectories (path);
 					foreach (string dir in DirList)



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