Commit 0df2458d authored by Felix Paul Kühne's avatar Felix Paul Kühne

HTTPConnection: prevent crash when uploading a file exceeding the device's...

HTTPConnection: prevent crash when uploading a file exceeding the device's free storage (close #10490)
parent 777dd744
......@@ -166,8 +166,21 @@
- (void)processContent:(NSData*)data WithHeader:(MultipartMessageHeader*) header
{
// here we just write the output from parser to the file.
if (_storeFile)
[_storeFile writeData:data];
if (_storeFile) {
@try {
[_storeFile writeData:data];
}
@catch (NSException *exception) {
APLog(@"File to write further data because storage is full.");
}
@finally {
[_storeFile closeFile];
_storeFile = nil;
/* don't block */
[self performSelector:@selector(stop) withObject:nil afterDelay:0.1];
}
}
}
- (void)processEndOfPartWithHeader:(MultipartMessageHeader*)header
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment