Skip to content

Commit

Permalink
Merge pull request #27 from jonchui/master
Browse files Browse the repository at this point in the history
Fixes startup crash. by checking for nil, before calling #takeRetainedValue
  • Loading branch information
luosheng authored May 16, 2017
2 parents e554a3d + fc6ba4d commit a1923a0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions OpenSim/LaunchAtLoginHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ func existingItem(itemUrl: URL) -> LSSharedFileListItem? {
if let currentItems = LSSharedFileListCopySnapshot(loginItems, &seed).takeRetainedValue() as? [LSSharedFileListItem] {
for item in currentItems {
let resolutionFlags = UInt32(kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes)
let url = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, nil).takeRetainedValue() as URL
if itemUrl == url {
return item
if let cfurl = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, nil) {
let url = cfurl.takeRetainedValue() as URL
if itemUrl == url {
return item
}
}

}
}
return nil
Expand Down

0 comments on commit a1923a0

Please sign in to comment.