title: Do not start loop if error message is returned in API request
body: <p>I'm making a API Call for some live information. When there is no live information it will return:</p>
  
  <p>error = "No live games found";</p>
  
  <p>Otherwise it will return different information like hometeam, awayteam, score and so on.</p>
  
  <p>In my loop i'm adding these information to an array arrayEuropa. The problem is if the api request return the error message it should not add anything to the arrayEuropa.</p>
  
  <p>How can i obtain this?</p>
  
  <p>i've tried different things that works when it return the error message, but crashed when there is no error message.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>NSDictionary* headers4 = @{@"X-Mashape-Authorization": @"key"};
  NSDictionary* parameters4 = @{};
  
  UNIHTTPJsonResponse* response4 = [[UNIRest get:^(UNISimpleRequest* request4) {
      [request4 setUrl:@"https://willjw-statsfc-competitions.p.mashape.com/live.json?key=APIKEY&amp;competition=europa-league&amp;timezone=Europe%2FLondon"];
  
      [request4 setHeaders:headers4];
      [request4 setParameters:parameters4];
  }] asJson];
  
  
  NSData* rawBody4 = [response4 rawBody];
  results4 = [NSJSONSerialization JSONObjectWithData:rawBody4 options:NSJSONReadingMutableContainers error:nil];
  
  for (int i = 0; i &lt;= results4.count-1; i++)
  {
  
  
      NSString *homeTeam = [[results4 valueForKey:@"homeshort"] objectAtIndex:i ];
      NSString *awayTeam = [[results4 valueForKey:@"awayshort"] objectAtIndex:i ];
      NSString *time = [[results4 valueForKey:@"statusshort"] objectAtIndex:i ];
      NSString *homeScore = [NSString stringWithFormat:@"%@", [[[results4 valueForKey:@"runningscore"] objectAtIndex:i ] objectAtIndex:0]];
      NSString *awayScore = [NSString stringWithFormat:@"%@", [[[results4 valueForKey:@"runningscore"] objectAtIndex:i ] objectAtIndex:1]];
  
  
      [arrayEuropa addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:homeTeam,@"hometeam", awayTeam,@"awayteam", time, @"time", homeScore, @"homescore", awayScore, @"awayscore", nil]];
  
  }
  </code></pre>