[longomatch] Fix critical error when no databases exists
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix critical error when no databases exists
- Date: Sun, 13 Oct 2013 00:28:09 +0000 (UTC)
commit 318be2815c13a8d5da2d223747db19190d703d0f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sun Oct 13 02:27:36 2013 +0200
Fix critical error when no databases exists
LongoMatch.Services/Services/DataBaseManager.cs | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.Services/Services/DataBaseManager.cs b/LongoMatch.Services/Services/DataBaseManager.cs
index 6f3f258..1c94e61 100644
--- a/LongoMatch.Services/Services/DataBaseManager.cs
+++ b/LongoMatch.Services/Services/DataBaseManager.cs
@@ -49,12 +49,12 @@ namespace LongoMatch.DB
}
public void SetActiveByName (string name) {
- IDatabase db = Databases.Where(p => p.Name == name).First();
-
- if (db != null) {
- Log.Information ("Selecting active database " + db.Name);
- ActiveDB = db;
- return;
+ foreach (DataBase db in Databases) {
+ if (db.Name == name) {
+ Log.Information ("Selecting active database " + db.Name);
+ ActiveDB = db;
+ return;
+ }
}
DataBase newdb = new DataBase(NameToFile (name));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]