mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-18 12:47:49 +08:00
Update EventEmitter.js (#23047)
Summary: added protection for emit() because subscription.listener may have been removed during event loop Changelog: ---------- [GENERAL][FIX] Avoid crash when subscription listener may have been removed during event loop Pull Request resolved: https://github.com/facebook/react-native/pull/23047 Differential Revision: D13761725 Pulled By: cpojer fbshipit-source-id: 0753b780067bd712cd43caf63020c3f0d6ea9f52
This commit is contained in:
committed by
Facebook Github Bot
parent
ec488dcf63
commit
47e77682d4
2
Libraries/vendor/emitter/EventEmitter.js
vendored
2
Libraries/vendor/emitter/EventEmitter.js
vendored
@@ -176,7 +176,7 @@ class EventEmitter {
|
||||
const subscription = subscriptions[i];
|
||||
|
||||
// The subscription may have been removed during this event loop.
|
||||
if (subscription) {
|
||||
if (subscription && subscription.listener) {
|
||||
this._currentSubscription = subscription;
|
||||
subscription.listener.apply(
|
||||
subscription.context,
|
||||
|
||||
Reference in New Issue
Block a user