Skip to content

Commit

Permalink
Fixing analyzer warning. Fixes issue CocoaLumberjack#40
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiehanson committed Jun 17, 2012
1 parent 9440aec commit 9537faa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Lumberjack/DDTTYLogger.m
Expand Up @@ -1212,7 +1212,7 @@ - (void)logMessage:(DDLogMessage *)logMessage
NSUInteger msgLen = [logMsg lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
const BOOL useStack = msgLen < (1024 * 4);

char msgStack[useStack ? (msgLen + 1) : 0];
char msgStack[useStack ? (msgLen + 1) : 1]; // Analyzer doesn't like zero-size array, hence the 1
char *msg = useStack ? msgStack : (char *)malloc(msgLen + 1);

[logMsg getCString:msg maxLength:(msgLen + 1) encoding:NSUTF8StringEncoding];
Expand Down

0 comments on commit 9537faa

Please sign in to comment.