Check if we are overwriting the source file and disallow it.

This commit is contained in:
Damiano Galassi committed 2016-07-27 09:49:29 +02:00
1 parent 4c2323a0c7
commit 5c8620f9d8
1 file changed
+11
+11
View File
@@ -675,6 +675,17 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
return NO;
}
for (MP42Track *track in self.tracks) {
NSURL *sourceURL = track.sourceURL.filePathURL;
if ([sourceURL isEqualTo:url]) {
if (outError) {
*outError = MP42Error(@"Invalid destination.", @"Can't overwrite the source movie.", 100);
[_logger writeErrorToLog:*outError];
}
return NO;
}
}
if (self.hasFileRepresentation) {
__block BOOL noErr = YES;