[banshee] [Banshee.Configuration] Wrap Get in try/catch
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Banshee.Configuration] Wrap Get in try/catch
- Date: Mon, 1 Mar 2010 22:24:49 +0000 (UTC)
commit 00ece379b6e611ffb57c76082ee09a40715143bb
Author: Gabriel Burt <gabriel burt gmail com>
Date: Mon Mar 1 14:23:19 2010 -0800
[Banshee.Configuration] Wrap Get in try/catch
.../DatabaseConfigurationClient.cs | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Configuration/DatabaseConfigurationClient.cs b/src/Core/Banshee.Services/Banshee.Configuration/DatabaseConfigurationClient.cs
index 6b53454..53aa309 100644
--- a/src/Core/Banshee.Services/Banshee.Configuration/DatabaseConfigurationClient.cs
+++ b/src/Core/Banshee.Services/Banshee.Configuration/DatabaseConfigurationClient.cs
@@ -81,12 +81,16 @@ namespace Banshee.Configuration
public T Get <T> (string namespce, string key, T fallback)
{
- using (IDataReader reader = Get (namespce, key)) {
- if (reader.Read ()) {
- return (T) Convert.ChangeType (reader.GetString (0), typeof (T));
- } else {
- return fallback;
+ try {
+ using (IDataReader reader = Get (namespce, key)) {
+ if (reader.Read ()) {
+ return (T) Convert.ChangeType (reader.GetString (0), typeof (T));
+ } else {
+ return fallback;
+ }
}
+ } catch {
+ return fallback;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]