Skip to content

Commit

Permalink
fix the crash caused by nil partialLoadHandler
Browse files Browse the repository at this point in the history
Summary:
## Problem
the partialLoadHandler is nil on line 338 of RCTImageLoader, therefore, if there is a cached image, it would crash on line 495.

## Change
Check if partialLoadHandler is nil on line 495 to prevent the crash

Changelog: [iOS][Changed] - fix the crash caused by nil partialLoadHandler

Reviewed By: appden

Differential Revision: D34544090

fbshipit-source-id: f9965700e529c5add1e25867a3772c053447d99a
  • Loading branch information
Mo Wang authored and facebook-github-bot committed Mar 1, 2022
1 parent 5980abf commit 46bc521
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Image/RCTImageLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ - (RCTImageURLLoaderRequest *)_loadImageOrDataWithURLRequest:(NSURLRequest *)req
BOOL cacheResult = [loadHandler respondsToSelector:@selector(shouldCacheLoadedImages)] ?
[loadHandler shouldCacheLoadedImages] : YES;

if (cacheResult) {
if (cacheResult && partialLoadHandler) {
UIImage *image = [[self imageCache] imageForUrl:request.URL.absoluteString
size:size
scale:scale
Expand Down

0 comments on commit 46bc521

Please sign in to comment.