diff --git a/app/Theme.m b/app/Theme.m index ae13f66a52..1321bcaa37 100644 --- a/app/Theme.m +++ b/app/Theme.m @@ -337,7 +337,12 @@ + (NSURL *)themesDirectory { + (NSArray *)userThemes { NSMutableArray *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]; }