Browse files

Fix for crash when height or width is nil (#20454)

This PR fixes the issue of height/width being nil in line no 128 of RCTImagePickerManager.m .
`    [self _dismissPicker:picker args:tempImageTag ? @[tempImageTag, height, width] : nil];

Test Plan
To verify the fix , please make the changes to make either height, width or both `nil `
 in `- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info` function of RCTImagePickerManager.m , run the code , you will see the error saying , one of the argument is nil from the array .



Now run the code with the fix , it will not crash .

Release Notes:
[IOS][BUGFIX][RCTImagePickerManager] - Change in RCTImagePickerManager to handle crashes if height/width is nil .
Pull Request resolved: #20454

Differential Revision: D9061059

Pulled By: hramos

fbshipit-source-id: b17f58e411f97f9b904cca0de6c151312c732972
  • Loading branch information...
abhi06276 authored and facebook-github-bot committed Jul 30, 2018
1 parent ca7eb14 commit 82af7c989be42a516f438f162d21f699be297e79
Showing with 1 addition and 1 deletion.
  1. +1 −1 Libraries/CameraRoll/RCTImagePickerManager.m
@@ -123,7 +123,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker
// WARNING: Using ImageStoreManager may cause a memory leak because the
// image isn't automatically removed from store once we're done using it.
[_bridge.imageStoreManager storeImage:originalImage withBlock:^(NSString *tempImageTag) {
[self _dismissPicker:picker args:tempImageTag ? @[tempImageTag, height, width] : nil];
[self _dismissPicker:picker args:tempImageTag ? @[tempImageTag, RCTNullIfNil(height), RCTNullIfNil(width)] : nil];

0 comments on commit 82af7c9

Please sign in to comment.