Skip to content

Commit

Permalink
add nullptr check to avoid crash in RCTScrollViewComponentView (#42156)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Jan 5, 2024
1 parent 016bb24 commit cabae39
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView

- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView
{
if (!_eventEmitter) {
return;
}

_isUserTriggeredScrolling = NO;
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollToTop([self _scrollViewMetrics]);
[self _updateStateWithContentOffset];
Expand Down

0 comments on commit cabae39

Please sign in to comment.