Add config null-check as remediation

Summary:
See code comment. D42282358 (7e96b65790) 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
This commit is contained in:
Nick Gerleman
2023-02-10 17:51:46 -08:00
committed by Facebook GitHub Bot
parent ba38a2c784
commit ed6223c0c0

View File

@@ -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];
}