Skip to content

Commit

Permalink
Add config null-check as remediation
Browse files Browse the repository at this point in the history
Summary:
See code comment. D42282358 (e55277c) 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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Feb 11, 2023
1 parent 9707378 commit b6b982f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down

0 comments on commit b6b982f

Please sign in to comment.