Skip to content

Commit

Permalink
Skip items in themes directory with no data
Browse files Browse the repository at this point in the history
For example, directories. Fixes #2343
  • Loading branch information
saagarjha committed Feb 4, 2024
1 parent 16ccb25 commit 353e767
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Theme.m
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,12 @@ + (NSURL *)themesDirectory {
+ (NSArray<Theme *> *)userThemes {
NSMutableArray<Theme *> *themes = [NSMutableArray new];
for (NSURL *file in [NSFileManager.defaultManager contentsOfDirectoryAtURL:self.themesDirectory includingPropertiesForKeys:nil options:0 error:nil]) {
Theme *theme = [[Theme alloc] initWithName:file.lastPathComponent.stringByDeletingPathExtension data:[NSData dataWithContentsOfURL:file]];
NSData *data = [NSData dataWithContentsOfURL:file];
if (!data) {
continue;
}

Theme *theme = [[Theme alloc] initWithName:file.lastPathComponent.stringByDeletingPathExtension data:data];
if (theme) {
[themes addObject:theme];
}
Expand Down

0 comments on commit 353e767

Please sign in to comment.