Merge pull request #619 from flybayer/fix-crash

Fix crash when not enough disk storage to save media
This commit is contained in:
Sibelius Seraphini 2018-01-07 14:01:43 -08:00 committed by GitHub
commit 35c5584099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -879,7 +879,14 @@ didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
if (error) {
self.videoReject(RCTErrorUnspecified, nil, RCTErrorWithMessage(error.description));
return;
} else if (assetURL == nil) {
//It's possible for writing to camera roll to fail,
//without receiving an error message, but assetURL will be nil
//Happens when disk is (almost) full
self.videoReject(RCTErrorUnspecified, nil, RCTErrorWithMessage(@"Not enough storage"));
return;
}
[videoInfo setObject:[assetURL absoluteString] forKey:@"path"];
self.videoResolve(videoInfo);
}];