Skip to content

Commit

Permalink
Merge pull request #26 from 166MMX/crash-fixes
Browse files Browse the repository at this point in the history
Fix crash where login items could not be resolved
  • Loading branch information
ElDeveloper authored Oct 17, 2016
2 parents 4932376 + 6d692eb commit 04b53f6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions MFCore/MFCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ BOOL mfcGetStateOfLoginItemWithPath(NSString *path) {
for(CFIndex i = 0; i < arrayCount; ++i) {
CFURLRef urlRef;
LSSharedFileListItemRef itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(loginItems, i);
LSSharedFileListItemResolve(itemRef, 0, &urlRef, NULL);
OSStatus status = LSSharedFileListItemResolve(itemRef, 0, &urlRef, NULL);
if (status != noErr) {
continue;
}
NSURL *theURL = (__bridge NSURL*) urlRef;
present = [[theURL path] isEqualToString:path];
CFRelease(urlRef);
Expand Down Expand Up @@ -109,7 +112,10 @@ BOOL mfcSetStateForAgentLoginItem(BOOL state) {
for(CFIndex i = 0; i < arrayCount; ++i) {
CFURLRef urlRef;
LSSharedFileListItemRef itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(loginItems, i);
LSSharedFileListItemResolve(itemRef, 0, &urlRef, NULL);
OSStatus status = LSSharedFileListItemResolve(itemRef, 0, &urlRef, NULL);
if (status != noErr) {
continue;
}
NSURL *theURL = (__bridge NSURL*) urlRef;
NSString* checkPath = [[theURL path] lastPathComponent];
CFRelease(urlRef);
Expand Down

0 comments on commit 04b53f6

Please sign in to comment.