Skip to content

Commit

Permalink
Fixed crash when passing nil arguments to definition through another …
Browse files Browse the repository at this point in the history
…definition (#214)
  • Loading branch information
alexgarbarev committed May 14, 2014
1 parent 1d5b7a7 commit d08c594
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/Factory/Block/TyphoonRuntimeArguments.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ - (id)argumentValueAtIndex:(NSUInteger)index

- (void)replaceArgumentAtIndex:(NSUInteger)index withArgument:(id)argument
{
if (!argument) {
argument = [TyphoonRuntimeNullArgument new];
}
[_arguments replaceObjectAtIndex:index withObject:argument];
_needRehash = YES;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ - (void)test_runtime_knight_with_nil
assertThatInt(knight.damselsRescued, equalToInt(0));
}

- (void)test_runtime_knight_with_method_arg_nil
{
Knight *knight = [factory knightWithRuntimeDamselsRescued:@(12) runtimeQuestUrl:nil];
assertThat([knight.quest imageUrl], equalTo(nil));
assertThatInt(knight.damselsRescued, equalToInt(12));
}


- (void)test_predefined_quest
{
Expand Down

0 comments on commit d08c594

Please sign in to comment.