Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[GRMustacheContext contextWithObject:nil] returns nil
  • Loading branch information
groue committed Feb 19, 2012
1 parent c9af39f commit b69bc56
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions Classes/GRMustacheContext.m
Expand Up @@ -48,6 +48,9 @@ + (void)preventNSUndefinedKeyExceptionAttack {
}

+ (id)contextWithObject:(id)object {
if (object == nil) {
return nil;
}
if ([object isKindOfClass:[GRMustacheContext class]]) {
return object;
}
Expand All @@ -64,18 +67,14 @@ + (id)contextWithObjects:(id)object, ... {

+ (id)contextWithObject:(id)object andObjectList:(va_list)objectList {
GRMustacheContext *context = nil;
if (object) {
context = [GRMustacheContext contextWithObject:object];
id eachObject;
va_list objectListCopy;
va_copy(objectListCopy, objectList);
while ((eachObject = va_arg(objectListCopy, id))) {
context = [context contextByAddingObject:eachObject];
}
va_end(objectListCopy);
} else {
context = [self contextWithObject:nil];
context = [GRMustacheContext contextWithObject:object];
id eachObject;
va_list objectListCopy;
va_copy(objectListCopy, objectList);
while ((eachObject = va_arg(objectListCopy, id))) {
context = [context contextByAddingObject:eachObject];
}
va_end(objectListCopy);
return context;
}

Expand Down

0 comments on commit b69bc56

Please sign in to comment.