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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ed6223c0c0
commit
220d2582c9
@@ -189,6 +189,7 @@ int32_t gConfigInstanceCount = 0;
|
|||||||
|
|
||||||
YOGA_EXPORT WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) {
|
YOGA_EXPORT WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) {
|
||||||
const YGNodeRef node = new YGNode{config};
|
const YGNodeRef node = new YGNode{config};
|
||||||
|
YGAssert(config != nullptr, "Tried to construct YGNode with null config");
|
||||||
YGAssertWithConfig(
|
YGAssertWithConfig(
|
||||||
config, node != nullptr, "Could not allocate memory for node");
|
config, node != nullptr, "Could not allocate memory for node");
|
||||||
Event::publish<Event::NodeAllocation>(node, {config});
|
Event::publish<Event::NodeAllocation>(node, {config});
|
||||||
@@ -4301,14 +4302,6 @@ YOGA_EXPORT void YGConfigSetExperimentalFeatureEnabled(
|
|||||||
YOGA_EXPORT bool YGConfigIsExperimentalFeatureEnabled(
|
YOGA_EXPORT bool YGConfigIsExperimentalFeatureEnabled(
|
||||||
const YGConfigRef config,
|
const YGConfigRef config,
|
||||||
const YGExperimentalFeature feature) {
|
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];
|
return config->experimentalFeatures[feature];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user