diff --git a/MP42/MP42Mp4Importer.m b/MP42/MP42Mp4Importer.m index 0081a4c..533dea5 100644 --- a/MP42/MP42Mp4Importer.m +++ b/MP42/MP42Mp4Importer.m @@ -39,13 +39,9 @@ - (instancetype)initWithURL:(NSURL *)fileURL error:(NSError **)outError; { if ((self = [super initWithURL:fileURL])) { - MP42File *sourceFile = [[MP42File alloc] initWithURL:self.fileURL]; - - if(!sourceFile) { - if (outError) { - *outError = MP42Error(@"The movie could not be opened.", @"The file is not a mp4 file.", 100); - } + MP42File *sourceFile = [[MP42File alloc] initWithURL:self.fileURL error:outError]; + if (!sourceFile) { [self release]; return nil; } @@ -83,6 +79,10 @@ const char *trackType = MP4GetTrackType(_fileHandle, srcTrackId); const char *media_data_name = MP4GetTrackMediaDataName(_fileHandle, srcTrackId); + if (!trackType) { + return nil; + } + if (MP4_IS_AUDIO_TRACK_TYPE(trackType)){ if (!strcmp(media_data_name, "ac-3")) {