Bug Fix: Add some safety checks to URL handlers

A few places could have used nil checks, but there shouldn't be anything
passing nil URLs to these. Well, just in case, at least it won't lead to
crashes or something...

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-06-06 01:27:54 -07:00
parent 5667a4039d
commit 9055bc45f3
3 changed files with 7 additions and 1 deletions

View file

@ -52,10 +52,14 @@
}
- (BOOL)open:(NSURL *)url withOutputFormat:(AudioStreamBasicDescription)outputFormat withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi {
if(!url) {
DLog(@"Player attempted to play invalid file...");
return NO;
}
[self setStreamURL:url];
[self setUserInfo:userInfo];
if (![self buildChain]) {
if(![self buildChain]) {
DLog(@"Couldn't build processing chain...");
return NO;
}

View file

@ -1112,6 +1112,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
}
- (NSArray *)addURL:(NSURL *)url {
if(!url) return [NSArray array];
return [self insertURLs:@[url] atIndex:(int)[[playlistController content] count] sort:NO];
}

View file

@ -420,6 +420,7 @@ static inline void dispatch_async_reentrant(dispatch_queue_t queue, dispatch_blo
}
- (const void *)beginFolderAccess:(NSURL *)fileUrl {
if(!fileUrl) return NULL;
NSURL *folderUrl = [SandboxBroker urlWithoutFragment:fileUrl];
if(![folderUrl isFileURL]) return NULL;