@@ -140,8 +140,9 @@ - (void)enumerateFilesInDirectory:(NSString *)directory
140140
141141 extension = [path pathExtension ];
142142 fullPath = [directory stringByAppendingPathComponent: path];
143-
144- block (fullPath, extension);
143+ if (block) {
144+ block (fullPath, extension);
145+ }
145146 }
146147}
147148
@@ -176,7 +177,7 @@ - (NSArray *)contentsOfDirectory:(NSString *)path {
176177 [array addObject: filePath];
177178 }];
178179
179- return array;
180+ return [ array copy ] ;
180181}
181182
182183#pragma - Properties
@@ -271,8 +272,9 @@ - (void)enumerateReportsInProcessingDirectoryUsingBlock:(void (^)(FIRCLSInternal
271272 usingBlock: ^(NSString *filePath, NSString *extension) {
272273 FIRCLSInternalReport *report =
273274 [FIRCLSInternalReport reportWithPath: filePath];
274-
275- block (report, filePath);
275+ if (block) {
276+ block (report, filePath);
277+ }
276278 }];
277279}
278280
@@ -304,27 +306,14 @@ - (BOOL)removeContentsOfPendingPath {
304306
305307- (BOOL )removeContentsOfAllPaths {
306308 BOOL success = YES ;
307-
308- // We want to call all of these methods, even if some fail, and return
309- // NO if any fail. This turned out to be slightly tricky to do in more
310- // compact forms, so I did it the simple but verbose way.
311-
312- if (![self removeContentsOfProcessingPath ]) {
313- success = NO ;
314- }
315-
316- if (![self removeContentsOfPendingPath ]) {
317- success = NO ;
318- }
319-
320- if (![self removeContentsOfDirectoryAtPath: self .preparedPath]) {
321- success = NO ;
322- }
323-
324- if (![self removeContentsOfDirectoryAtPath: self .activePath]) {
325- success = NO ;
326- }
327-
309+ BOOL contentsOfProcessingPathRemoved = [self removeContentsOfProcessingPath ];
310+ BOOL contentsOfPendingPathRemoved = [self removeContentsOfPendingPath ];
311+ BOOL contentsOfDirectoryAtPreparedPathRemoved =
312+ [self removeContentsOfDirectoryAtPath: self .preparedPath];
313+ BOOL contentsOfDirectoryAtActivePathRemoved =
314+ [self removeContentsOfDirectoryAtPath: self .activePath];
315+ success = contentsOfProcessingPathRemoved && contentsOfPendingPathRemoved &&
316+ contentsOfDirectoryAtPreparedPathRemoved && contentsOfDirectoryAtActivePathRemoved;
328317 return success;
329318}
330319
0 commit comments