From 70d23e82ad21a4cfde1ce7c3b1c00fe7c7d5adbd Mon Sep 17 00:00:00 2001 From: Alex Dvornikov Date: Tue, 23 Jan 2018 09:56:21 -0800 Subject: [PATCH] Check for nullptr when accessing isInspectable method Reviewed By: javache Differential Revision: D6785733 fbshipit-source-id: 1bbb884746e671124b7d2d950a3419ea33d70522 --- React/CxxBridge/RCTCxxBridge.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 4bfbe9926..a854c1937 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -191,11 +191,12 @@ struct RCTInstanceCallback : public InstanceCallback { - (JSGlobalContextRef)jsContextRef { - return (JSGlobalContextRef)(self->_reactInstance ? self->_reactInstance->getJavaScriptContext() : nullptr); + return (JSGlobalContextRef)(_reactInstance ? _reactInstance->getJavaScriptContext() : nullptr); } -- (BOOL)isInspectable { - return self->_reactInstance->isInspectable(); +- (BOOL)isInspectable +{ + return _reactInstance ? _reactInstance->isInspectable() : NO; } - (instancetype)initWithParentBridge:(RCTBridge *)bridge