Skip to content

errorHandler in -[EMSession sendTransaction:errorHandler:] crashes #7

@rcbello

Description

@rcbello

code in EMSession lines 86-99 passes the wrong error variable when error is caused by an invalid http status code, causing a crash on the errorHandler if the code access the error variable.

   // Parse response
      NSError *err = nil;
      NSInteger code = ((NSHTTPURLResponse *)response).statusCode;
      if (code != 200) {
          NSString *message = [NSString
              stringWithFormat:@"Unexpected http status code %ld", (long)code];
          ELOG(@"%@", message);
          NSDictionary *d = @{NSLocalizedDescriptionKey : message};
          err = [NSError errorWithDomain:EMErrorDomain
                                    code:EMErrorBadHTTPStatus
                                userInfo:d];
          errorHandler(error);
          return;
      }

variable passed to errorHandler should be err not error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions