[Issue #368] Checking for non-zero data length before attempting to append to write to output stream in multipart form data builder

This commit is contained in:
Mattt Thompson 2012-06-13 14:54:31 -07:00
parent d7852c19e1
commit 286b8100c5

View file

@ -837,6 +837,10 @@ static inline NSString * AFMultipartFormFinalBoundary() {
}
- (void)appendData:(NSData *)data {
if ([data length] == 0) {
return;
}
if ([self.outputStream hasSpaceAvailable]) {
const uint8_t *dataBuffer = (uint8_t *) [data bytes];
[self.outputStream write:&dataBuffer[0] maxLength:[data length]];