Permalink
Browse files

Removes Static Analyzer Warning

The function dispatch_source_create can return NULL and clang's static analyzer complains about this.

The code is moved inside a if-branch to execute it only when deleteTimer is not NULL.
  • Loading branch information...
1 parent 6c978fd commit 9ff30cd6ac14e21a8552d9780e3556484d7e9a12 @rsobik rsobik committed Nov 8, 2012
Showing with 12 additions and 10 deletions.
  1. +12 −10 Lumberjack/DDAbstractDatabaseLogger.m
@@ -220,16 +220,18 @@ - (void)createAndStartDeleteTimer
if ((deleteTimer == NULL) && (deleteInterval > 0.0) && (maxAge > 0.0))
{
deleteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
-
- dispatch_source_set_event_handler(deleteTimer, ^{ @autoreleasepool {
-
- [self performDelete];
-
- }});
-
- [self updateDeleteTimer];
-
- dispatch_resume(deleteTimer);
+
+ if (deleteTimer != NULL) {
+ dispatch_source_set_event_handler(deleteTimer, ^{ @autoreleasepool {
+
+ [self performDelete];
+
+ }});
+
+ [self updateDeleteTimer];
+
+ dispatch_resume(deleteTimer);
+ }
}
}

0 comments on commit 9ff30cd

Please sign in to comment.