Skip to content

Commit

Permalink
Merge pull request #1 from simplerdev/null-file-type
Browse files Browse the repository at this point in the history
fix null error when checking mime type for a file
  • Loading branch information
skydevht authored Feb 16, 2022
2 parents 3e58876 + 0600c10 commit f00d36e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ios/CDVLocalFilesystem.m
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,8 @@ - (NSString*) mimeTypeForFileAtPath: (NSString *) path {

CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)[path pathExtension], NULL);
CFStringRef mimeType = UTTypeCopyPreferredTagWithClass (UTI, kUTTagClassMIMEType);
CFRelease(UTI);
if (UTI != NULL) // It happens when checking for a null file and the above snippet use deprecated functions
CFRelease(UTI);

if (!mimeType) {
return @"application/octet-stream";
Expand Down

0 comments on commit f00d36e

Please sign in to comment.