[rygel] media-export: Fix endless loop when upgrading fails



commit 259a47e562fbc0fa70097bfa95870f0209485387
Author: Jens Georg <jensg openismus com>
Date:   Tue Jan 22 14:43:21 2013 +0100

    media-export: Fix endless loop when upgrading fails

 .../rygel-media-export-media-cache-upgrader.vala   |   72 ++++++++++----------
 1 files changed, 37 insertions(+), 35 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala b/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala
index 07bfdbc..3fbf339 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache-upgrader.vala
@@ -84,42 +84,44 @@ internal class Rygel.MediaExport.MediaCacheUpgrader {
         debug ("Older schema detected. Upgrading...");
         int current_version = int.parse (SQLFactory.SCHEMA_VERSION);
         while (old_version < current_version) {
-            if (this.database != null) {
-                switch (old_version) {
-                    case 3:
-                        update_v3_v4 ();
-                        break;
-                    case 4:
-                        update_v4_v5 ();
-                        break;
-                    case 5:
-                        update_v5_v6 ();
-                        break;
-                    case 6:
-                        update_v6_v7 ();
-                        break;
-                    case 7:
-                        update_v7_v8 ();
-                        break;
-                    case 8:
-                        update_v8_v9 ();
-                        break;
-                    case 9:
-                        update_v9_v10 ();
-                        break;
-                    case 10:
-                        update_v10_v11 ();
-                        break;
-                    case 11:
-                        update_v11_v12 ();
-                        break;
-                    default:
-                        warning ("Cannot upgrade");
-                        database = null;
-                        break;
-                }
-                old_version++;
+            if (this.database == null) {
+                break;
+            }
+
+            switch (old_version) {
+                case 3:
+                    update_v3_v4 ();
+                    break;
+                case 4:
+                    update_v4_v5 ();
+                    break;
+                case 5:
+                    update_v5_v6 ();
+                    break;
+                case 6:
+                    update_v6_v7 ();
+                    break;
+                case 7:
+                    update_v7_v8 ();
+                    break;
+                case 8:
+                    update_v8_v9 ();
+                    break;
+                case 9:
+                    update_v9_v10 ();
+                    break;
+                case 10:
+                    update_v10_v11 ();
+                    break;
+                case 11:
+                    update_v11_v12 ();
+                    break;
+                default:
+                    warning ("Cannot upgrade");
+                    database = null;
+                    break;
             }
+            old_version++;
         }
     }
 



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