From c36f4c5f84b1125da13d9624331d7dcd733ee329 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 31 Oct 2015 23:45:37 -0700 Subject: [PATCH] Remove abort calls --- Limelight/AppDelegate.m | 40 ++++++++++----------------------------- Limelight/Crypto/mkcert.c | 2 -- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/Limelight/AppDelegate.m b/Limelight/AppDelegate.m index e976e41..2a3b8ec 100644 --- a/Limelight/AppDelegate.m +++ b/Limelight/AppDelegate.m @@ -83,10 +83,7 @@ static NSOperationQueue* mainQueue; NSManagedObjectContext *managedObjectContext = self.managedObjectContext; if (managedObjectContext != nil) { if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) { - // Replace this implementation with code to handle the error appropriately. - // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. - Log(LOG_E, @"Unresolved error %@, %@", error, [error userInfo]); - abort(); + Log(LOG_E, @"Critical database error: %@, %@", error, [error userInfo]); } } } @@ -136,32 +133,15 @@ static NSOperationQueue* mainQueue; [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error]) { - /* - Replace this implementation with code to handle the error appropriately. - - abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. - - Typical reasons for an error here include: - * The persistent store is not accessible; - * The schema for the persistent store is incompatible with current managed object model. - Check the error message to determine what the actual problem was. - - - If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory. - - If you encounter schema incompatibility errors during development, you can reduce their frequency by: - * Simply deleting the existing store: - [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil] - - * Performing automatic lightweight migration by passing the following dictionary as the options parameter: - @{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES} - - Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details. - - */ - Log(LOG_E, @"Unresolved error %@, %@", error, [error userInfo]); - abort(); - } + // Log the error + Log(LOG_E, @"Critical database error: %@, %@", error, [error userInfo]); + + // Drop the database + [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]; + + // Try again + return [self persistentStoreCoordinator]; + } return _persistentStoreCoordinator; } diff --git a/Limelight/Crypto/mkcert.c b/Limelight/Crypto/mkcert.c index 50478dc..98a5d49 100644 --- a/Limelight/Crypto/mkcert.c +++ b/Limelight/Crypto/mkcert.c @@ -85,7 +85,6 @@ int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int years) { if (*pkeyp == NULL) { if ((pk=EVP_PKEY_new()) == NULL) { - abort(); return(0); } } else { @@ -102,7 +101,6 @@ int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int years) { rsa = RSA_generate_key(bits, RSA_F4, NULL, NULL); if (!EVP_PKEY_assign_RSA(pk, rsa)) { - abort(); goto err; }