mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00: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:
1 parent
ec488dcf63
commit
47e77682d4
1 file changed
+1
-1
+1
-1
@@ -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