Fabric: Added assert in ShadowNode

Summary:
It's not allowed to return nullptr from the callback. The assert ensures it which is helpful during development.

Probably, we should consider using `gsl::not_null<>` here.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21149891

fbshipit-source-id: a5f77b35029f22b499491721036405682f812a38
This commit is contained in:
Valentin Shergin
2020-04-24 21:26:42 -07:00
committed by Facebook GitHub Bot
parent 81734276b9
commit fef8bc33df
@@ -263,6 +263,10 @@ ShadowNode::Unshared ShadowNode::cloneTree(
auto newShadowNode = callback(*oldShadowNode);
assert(
newShadowNode &&
"`callback` returned `nullptr` which is not allowed value.");
auto childNode = newShadowNode;
for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {