From ed6223c0c075675cd792dde67936ec15c91cfc5a Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Fri, 10 Feb 2023 17:51:46 -0800 Subject: [PATCH] Add config null-check as remediation Summary: See code comment. D42282358 (https://github.com/facebook/yoga/commit/7e96b65790c53359583e480776278159556b7def) added usage of `YGConfigIsExperimentalFeatureEnabled` during layout, in a place where we sometimes encounter a Yoga node from RN which has an unexpectedly null config. This is a hack to stop the bleed while we add logging to figure out where the null config is coming from in RN. Changelog: [Internal] Reviewed By: rozele Differential Revision: D43203521 fbshipit-source-id: 2a21143a45c712ca00d16172f734fb116d165926 --- yoga/Yoga.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 2c8f45b0..bdbf5102 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -4301,6 +4301,14 @@ YOGA_EXPORT void YGConfigSetExperimentalFeatureEnabled( YOGA_EXPORT bool YGConfigIsExperimentalFeatureEnabled( const YGConfigRef config, const YGExperimentalFeature feature) { + // S323291 + T145030974 + T145292944: Node config should never be null, but + // Yoga has a private API used by RN to set config which does not check, and + // we crash here where config is null. Add a null check as temporary + // remediation + if (config == nullptr) { + return false; + } + return config->experimentalFeatures[feature]; }