add nullptr check to avoid crash in RCTScrollViewComponentView (#42156)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42156

changelog: [internal]

Add a missing nullptr check to prevent crash if called after component was reused

Reviewed By: fkgozali

Differential Revision: D52572807

fbshipit-source-id: 1b5b26996e562abbcb986865299e02df20b58043
This commit is contained in:
Samuel Susla 2024-01-05 15:13:53 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 016bb24eac
Коммит cabae397c6
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -471,6 +471,10 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView
{
if (!_eventEmitter) {
return;
}
_isUserTriggeredScrolling = NO;
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollToTop([self _scrollViewMetrics]);
[self _updateStateWithContentOffset];