diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index c996c5f13..2cdd3f6eb 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -753,11 +753,14 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL) if (!image) { // Attempt to load from the file system - NSString *filePath = [NSString stringWithUTF8String:[imageURL fileSystemRepresentation]]; - if (filePath.pathExtension.length == 0) { - filePath = [filePath stringByAppendingPathExtension:@"png"]; + const char* fileSystemCString = [imageURL fileSystemRepresentation]; + if (fileSystemCString != NULL) { + NSString *filePath = [NSString stringWithUTF8String:fileSystemCString]; + if (filePath.pathExtension.length == 0) { + filePath = [filePath stringByAppendingPathExtension:@"png"]; + } + image = [UIImage imageWithContentsOfFile:filePath]; } - image = [UIImage imageWithContentsOfFile:filePath]; } if (!image && !bundle) {