Permalink
Browse files

Support for detecting NSNull and zero length NSStrings as false

  • Loading branch information...
1 parent 8371f76 commit 050a5f027443b380e59422e15620c557c0170398 @glencoates glencoates committed Aug 26, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 MGTemplateStandardMarkers.m
@@ -582,7 +582,14 @@ - (BOOL)argIsTrue:(NSString *)arg
if (val) {
if ([val isKindOfClass:[NSNumber class]]) {
argTrue = [(NSNumber *)val boolValue];
- } else {
+ }
+ else if ([val isKindOfClass:[NSString class]]) {
+ argTrue = ([(NSString *)val length] > 0);
+ }
+ else if ([val isKindOfClass:[NSNull class]]) {
+ argTrue = NO;
+ }
+ else {
argTrue = YES;
}
}

0 comments on commit 050a5f0

Please sign in to comment.