diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 7756a7761545d3..824a140c7c7063 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -141,16 +141,21 @@ - (NSString *)accessibilityLabel - (NSArray *)accessibilityElements { - if (![_accessibilityProvider isUpToDate:_state->getData().attributedString]) { + if (!_state) { + return [NSArray new]; + } + + auto &data = _state->getData(); + + if (![_accessibilityProvider isUpToDate:data.attributedString]) { RCTTextLayoutManager *textLayoutManager = - (RCTTextLayoutManager *)unwrapManagedObject(_state->getData().layoutManager->getNativeTextLayoutManager()); + (RCTTextLayoutManager *)unwrapManagedObject(data.layoutManager->getNativeTextLayoutManager()); CGRect frame = RCTCGRectFromRect(_layoutMetrics.getContentFrame()); - _accessibilityProvider = - [[RCTParagraphComponentAccessibilityProvider alloc] initWithString:_state->getData().attributedString - layoutManager:textLayoutManager - paragraphAttributes:_state->getData().paragraphAttributes - frame:frame - view:self]; + _accessibilityProvider = [[RCTParagraphComponentAccessibilityProvider alloc] initWithString:data.attributedString + layoutManager:textLayoutManager + paragraphAttributes:data.paragraphAttributes + frame:frame + view:self]; } self.isAccessibilityElement = NO;