From 220d2582c94517b59d1c36f1c2faf5e3f88306f1 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 14 Feb 2023 09:42:43 -0800 Subject: [PATCH] Remove config null check Summary: This removes the null-check on Yoga config added (we think we root-caused the issue), and adds an assertion to the public API accepting a config that it is non-null. There are more changes to config setting that will come later. Changelog: [Internal] Reviewed By: javache Differential Revision: D43273456 fbshipit-source-id: cba498352d114a3fa2694f3a144f5f01a83d3190 --- yoga/Yoga.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index bdbf5102..d7125730 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -189,6 +189,7 @@ int32_t gConfigInstanceCount = 0; YOGA_EXPORT WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) { const YGNodeRef node = new YGNode{config}; + YGAssert(config != nullptr, "Tried to construct YGNode with null config"); YGAssertWithConfig( config, node != nullptr, "Could not allocate memory for node"); Event::publish(node, {config}); @@ -4301,14 +4302,6 @@ 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]; }