Bug Fixes: Some more generic NULL URL checks
Also catch some invalid URLs in the database. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
d41e34913a
commit
6b2adb8a88
3 changed files with 13 additions and 2 deletions
|
@ -392,7 +392,9 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
for(url in urls) {
|
||||
id<SentrySpan> pathTask = [sandboxTask startChildWithOperation:@"Process one folder" description:[NSString stringWithFormat:@"Processing file or folder: %@", url]];
|
||||
@try {
|
||||
if(!url) continue;
|
||||
if([url isFileURL]) {
|
||||
if(![url path]) continue;
|
||||
BOOL isDir;
|
||||
if([[NSFileManager defaultManager] fileExistsAtPath:[url path] isDirectory:&isDir]) {
|
||||
if(isDir == YES) {
|
||||
|
@ -419,6 +421,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
}
|
||||
} else {
|
||||
// Non-file URL..
|
||||
if(![url absoluteString]) continue;
|
||||
[expandedURLs setValue:url forKey:[PlaylistLoader keyForPath:[url absoluteString]]];
|
||||
}
|
||||
|
||||
|
@ -810,7 +813,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
|
|||
- (void)loadInfoForEntries:(NSArray *)entries {
|
||||
NSMutableDictionary *queueThisJob = [[NSMutableDictionary alloc] init];
|
||||
for(PlaylistEntry *pe in entries) {
|
||||
if(!pe || !pe.urlString || pe.deLeted || pe.metadataLoaded) continue;
|
||||
if(!pe || !pe.urlString || ![pe.urlString length] || pe.deLeted || pe.metadataLoaded) continue;
|
||||
|
||||
NSString *path = pe.urlString;
|
||||
NSMutableArray *entrySet = [queueThisJob objectForKey:path];
|
||||
|
@ -1160,7 +1163,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
|
|||
NSMutableIndexSet *pruneSet = [[NSMutableIndexSet alloc] init];
|
||||
NSUInteger index = 0;
|
||||
for(PlaylistEntry *pe in resultsCopy) {
|
||||
if(pe.deLeted || !pe.urlString || [pe.urlString length] < 1) {
|
||||
if(pe.deLeted || !pe.urlString || ![pe.urlString length]) {
|
||||
[pruneSet addIndex:index];
|
||||
[moc deleteObject:pe];
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#import "SandboxBroker.h"
|
||||
|
||||
#import "Logging.h"
|
||||
|
||||
@implementation FileSource
|
||||
|
||||
+ (void)initialize {
|
||||
|
@ -34,6 +36,10 @@
|
|||
sbHandle = [sandboxBroker beginFolderAccess:url];
|
||||
|
||||
NSString *path = [url path];
|
||||
if(!path) {
|
||||
ALog(@"Invalid URL: %@", url);
|
||||
return NO;
|
||||
}
|
||||
|
||||
fex_type_t type;
|
||||
fex_err_t error = fex_identify_file(&type, [path UTF8String]);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
8307D31B2860722C000FF8EB /* SandboxBroker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SandboxBroker.h; path = ../../Utils/SandboxBroker.h; sourceTree = "<group>"; };
|
||||
8335FF6817FF765A002D8DD2 /* File_Extractor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = File_Extractor.xcodeproj; path = ../../Frameworks/File_Extractor/File_Extractor.xcodeproj; sourceTree = "<group>"; };
|
||||
834A42AD287AF25600EB9D9B /* AudioChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioChunk.h; path = ../../Audio/Chain/AudioChunk.h; sourceTree = "<group>"; };
|
||||
835F15B82DF80DE1008C7054 /* Logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = /Users/chris/Source/Repos/cog/Utils/Logging.h; sourceTree = "<absolute>"; };
|
||||
83747C4F2862DD2F0021245F /* Shared.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Shared.xcconfig; sourceTree = "<group>"; };
|
||||
8D5B49B6048680CD000E48DA /* FileSource.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FileSource.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
|
@ -93,6 +94,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
834A42AD287AF25600EB9D9B /* AudioChunk.h */,
|
||||
835F15B82DF80DE1008C7054 /* Logging.h */,
|
||||
8307D31B2860722C000FF8EB /* SandboxBroker.h */,
|
||||
17ADB4080B979A8A00257CA2 /* Plugin.h */,
|
||||
17ADB4180B979AEB00257CA2 /* FileSource.h */,
|
||||
|
|
Loading…
Reference in a new issue