From: Jay Freeman (saurik) Date: Fri, 24 Oct 2014 09:50:10 +0000 (-0700) Subject: Only remove entry if it was actually there before. X-Git-Tag: v1.1~1 X-Git-Url: https://git.saurik.com/afc2d.git/commitdiff_plain/9a02c79e55c8de8fbf4f8ccb59e3d3e16023d35c?ds=inline Only remove entry if it was actually there before. --- diff --git a/postrm.mm b/postrm.mm index d3b1332..1e1ea7c 100644 --- 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; }