Skip to content

Commit bc23ed6

Browse files
committed
[Sandbox Configuration] Fix nil pointer issues
Solve some nil pointer issues with the Sandbox configuration code being set with invalid paths. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
1 parent 5d30779 commit bc23ed6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Utils/SandboxBroker.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ + (BOOL)isPath:(NSURL *)path aSubdirectoryOf:(NSURL *)directory {
144144

145145
- (SandboxEntry *)recursivePathTest:(NSURL *)url {
146146
for(SandboxEntry *entry in storage) {
147-
if([SandboxBroker isPath:url aSubdirectoryOf:[NSURL fileURLWithPath:entry.path]]) {
147+
if(entry.path && [SandboxBroker isPath:url aSubdirectoryOf:[NSURL fileURLWithPath:entry.path]]) {
148148
entry.refCount += 1;
149149
return entry;
150150
}
@@ -162,11 +162,9 @@ - (SandboxEntry *)recursivePathTest:(NSURL *)url {
162162

163163
if(results && [results count] > 0) {
164164
for(SandboxToken *token in results) {
165-
if([SandboxBroker isPath:url aSubdirectoryOf:[NSURL fileURLWithPath:token.path]]) {
165+
if(token.path && [SandboxBroker isPath:url aSubdirectoryOf:[NSURL fileURLWithPath:token.path]]) {
166166
SandboxEntry *entry = [[SandboxEntry alloc] initWithToken:token];
167167

168-
[storage addObject:entry];
169-
170168
BOOL isStale;
171169
NSError *err = nil;
172170
NSURL *secureUrl = [NSURL URLByResolvingBookmarkData:token.bookmark options:NSURLBookmarkResolutionWithSecurityScope relativeToURL:nil bookmarkDataIsStale:&isStale error:&err];
@@ -177,6 +175,8 @@ - (SandboxEntry *)recursivePathTest:(NSURL *)url {
177175

178176
entry.secureUrl = secureUrl;
179177

178+
[storage addObject:entry];
179+
180180
[secureUrl startAccessingSecurityScopedResource];
181181

182182
return entry;

0 commit comments

Comments
 (0)