]> git.saurik.com Git - cydia.git/commitdiff
Repair corrupted package databases.
authorJay Freeman (saurik) <saurik@saurk.com>
Mon, 3 Mar 2008 00:15:12 +0000 (00:15 +0000)
committerJay Freeman (saurik) <saurik@saurk.com>
Mon, 3 Mar 2008 00:15:12 +0000 (00:15 +0000)
Cydia.mm

index 5d737f83a50fc1f391856a55b3c45c721433dc97..c24ec4216ee4cbbc9c2820e0c8e6bfa7d1c92500 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -1722,7 +1722,14 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
     delete resolver_;
     delete records_;
     cache_.Close();
-    _assert(cache_.Open(progress_, true));
+
+    if (!cache_.Open(progress_, true)) {
+        fprintf(stderr, "repairing corrupted database...\n");
+        _error->Discard();
+        [self update];
+        _assert(cache_.Open(progress_, true));
+    }
+
     records_ = new pkgRecords(cache_);
     resolver_ = new pkgProblemResolver(cache_);
     fetcher_ = new pkgAcquire(&status_);