f-spot r4064 - trunk/src



Author: sdelcroix
Date: Fri Jun 13 12:38:17 2008
New Revision: 4064
URL: http://svn.gnome.org/viewvc/f-spot?rev=4064&view=rev

Log:
safer getter

Modified:
   trunk/src/Preferences.cs

Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs	(original)
+++ trunk/src/Preferences.cs	Fri Jun 13 12:38:17 2008
@@ -116,8 +116,6 @@
 			case MAIN_WINDOW_Y:
 			case MAIN_WINDOW_HEIGHT:
 			case MAIN_WINDOW_WIDTH:
-				return null;
-				
 			case IMPORT_WINDOW_HEIGHT:
 			case IMPORT_WINDOW_WIDTH:
 			case IMPORT_WINDOW_PANE_POSITION:
@@ -213,11 +211,15 @@
 					return (T)o;
 
 				try {
-					val = (T) Backend.Get (key);
-				} catch (NoSuchKeyException) {
-					val = (T) GetDefault (key);
-				} catch (InvalidCastException) {
-					val = (T) GetDefault (key);
+					try {
+						val = (T) Backend.Get (key);
+					} catch (NoSuchKeyException) {
+						val = (T) GetDefault (key);
+					} catch (InvalidCastException) {
+						val = (T) GetDefault (key);
+					}
+				} catch {
+					val = default(T);
 				}
 				
 				cache.Add (key, val);



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