diff --git a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp index 7f3c1f0382a..8861c82f556 100644 --- a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp @@ -30,6 +30,11 @@ static LayoutableSmallVector calculateTransformedFrames( for (int i = size - 1; i >= 0; --i) { auto currentShadowNode = traitCast(shadowNodeList.at(i)); + + if (!currentShadowNode) { + return {}; + } + auto currentFrame = currentShadowNode->getLayoutMetrics().frame; if (policy.includeTransform) { @@ -166,6 +171,11 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics( auto transformedFrames = shouldCalculateTransformedFrames ? calculateTransformedFrames(shadowNodeList, policy) : LayoutableSmallVector(); + + if (transformedFrames.empty()) { + return EmptyLayoutMetrics; + } + auto layoutMetrics = descendantLayoutableNode->getLayoutMetrics(); auto &resultFrame = layoutMetrics.frame; resultFrame.origin = {0, 0};