From 543ae8fd72e7527d58d27783606eaaf65b8541b2 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Sat, 4 Mar 2017 12:50:04 -0600 Subject: [PATCH] fix: crash when not enough disk storage to save media --- ios/RCTCameraManager.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ios/RCTCameraManager.m b/ios/RCTCameraManager.m index 1e9d646..f7e2822 100644 --- a/ios/RCTCameraManager.m +++ b/ios/RCTCameraManager.m @@ -831,7 +831,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); }];