From c7f7b4c87ac4dfcefb145a0f7111d2ae24bf40fc Mon Sep 17 00:00:00 2001 From: Peter Argany Date: Mon, 16 Dec 2019 16:37:53 -0800 Subject: [PATCH] Move RCTImageLoader asserts to protect bridge usage Summary: `RCTImageLoader ` needs loaders & decoders. These can be passed in through init, or looked up at runtime using the bridge. In bridgeless mode, we need to pass them in through init. This diff just moves the assert to actually protect `_bridge` usage, since there exist other codepaths which don't use the bridge. Changelog: [iOS][Internal] Move RCTImageLoader asserts to protect bridge usage Reviewed By: RSNara Differential Revision: D18990760 fbshipit-source-id: 285008e7b3f473c45381ab472c3d86e5d8e218ae --- Libraries/Image/RCTImageLoader.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Image/RCTImageLoader.mm b/Libraries/Image/RCTImageLoader.mm index 6b82d8283ca..0779c10f922 100644 --- a/Libraries/Image/RCTImageLoader.mm +++ b/Libraries/Image/RCTImageLoader.mm @@ -169,11 +169,11 @@ RCT_EXPORT_MODULE() if (!_loaders) { // Get loaders, sorted in reverse priority order (highest priority first) - RCTAssert(_bridge, @"Bridge not set"); if (_loadersProvider) { _loaders = _loadersProvider(); } else { + RCTAssert(_bridge, @"Trying to find RCTImageURLLoaders and bridge not set."); _loaders = [_bridge modulesConformingToProtocol:@protocol(RCTImageURLLoader)]; } @@ -233,11 +233,11 @@ RCT_EXPORT_MODULE() if (!_decoders) { // Get decoders, sorted in reverse priority order (highest priority first) - RCTAssert(_bridge, @"Bridge not set"); if (_decodersProvider) { _decoders = _decodersProvider(); } else { + RCTAssert(_bridge, @"Trying to find RCTImageDataDecoders and bridge not set."); _decoders = [_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)]; }