]> git.saurik.com Git - afc2d.git/commitdiff
Only remove entry if it was actually there before.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Oct 2014 09:50:10 +0000 (02:50 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Oct 2014 09:50:10 +0000 (02:50 -0700)
postrm.mm

index d3b13327093b1f76d9c65a4753443530cc137277..1e1ea7c925e0839786af8bdf87966ecd15e445c5 100644 (file)
--- a/postrm.mm
+++ b/postrm.mm
@@ -32,12 +32,13 @@ int main(int argc, const char *argv[]) {
     NSString *path(@"/System/Library/Lockdown/Services.plist");
     NSMutableDictionary *services([NSMutableDictionary dictionaryWithContentsOfFile:path]);
 
-    [services removeObjectForKey:@"com.apple.afc2"];
+    if (services != nil && [services objectForKey:@"com.apple.afc2"] != nil) {
+        [services removeObjectForKey:@"com.apple.afc2"];
+        [services writeToFile:path atomically:YES];
+    }
 
-    [services writeToFile:path atomically:YES];
     system("/bin/launchctl stop com.apple.mobile.lockdown");
 
     [pool release];
-
     return 0;
 }