Skip to content

Commit

Permalink
Handle no friend case for publishing to friend's wall. Small memory l…
Browse files Browse the repository at this point in the history
…eak fix, need to release before making savedAPIResult nil first.
  • Loading branch information
Christine Abernathy committed Oct 13, 2011
1 parent be0c9f0 commit e0e813b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sample/Hackbook/Hackbook/APICallsViewController.m
Expand Up @@ -968,7 +968,7 @@ - (void)request:(FBRequest *)request didLoad:(id)result {
{
NSArray *resultData = [result objectForKey:@"data"];
// Check that the user has friends
if ([result count] > 0) {
if ([resultData count] > 0) {
// Pick a random friend to post the feed to
int randomNumber = arc4random() % [resultData count];
[self apiDialogFeedFriend:[[resultData objectAtIndex:randomNumber] objectForKey:@"id"]];
Expand All @@ -980,8 +980,8 @@ - (void)request:(FBRequest *)request didLoad:(id)result {
case kAPIGetAppUsersFriendsNotUsing:
{
// Save friend results
savedAPIResult = nil;
[savedAPIResult release];
savedAPIResult = nil;
// Many results
if ([result isKindOfClass:[NSArray class]]) {
savedAPIResult = [[NSMutableArray alloc] initWithArray:result copyItems:YES];
Expand Down

0 comments on commit e0e813b

Please sign in to comment.