Skip to content

Commit f00d36e

Browse files
authored
Merge pull request #1 from simplerdev/null-file-type
fix null error when checking mime type for a file
2 parents 3e58876 + 0600c10 commit f00d36e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ios/CDVLocalFilesystem.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@ - (NSString*) mimeTypeForFileAtPath: (NSString *) path {
739739

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

744745
if (!mimeType) {
745746
return @"application/octet-stream";

0 commit comments

Comments
 (0)