Permalink
Browse files

Handle no friend case for publishing to friend's wall. Small memory l…

…eak fix, need to release before making savedAPIResult nil first.
  • Loading branch information...
1 parent be0c9f0 commit e0e813b325365367c7ea998629dba20b4840e1b2 Christine Abernathy committed Oct 13, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 sample/Hackbook/Hackbook/APICallsViewController.m
@@ -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"]];
@@ -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];

0 comments on commit e0e813b

Please sign in to comment.