mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-30 17:18:41 +08:00
Fix crash when passing null to clearImmediate
Summary:Passing `undefined` or `null` to `clearImmediate` caused apps to crash. It it caused because we try to find the index of the null/undefined timer when we should just do nothing when passed these values. It is already handled properly in the other Timer functions. **Test plan** Calling `clearImmediate` with `undefined` or `null` should do nothing. Closes https://github.com/facebook/react-native/pull/6192 Differential Revision: D2987778 Pulled By: vjeux fb-gh-sync-id: 6fd38cfa3c10012caa2afb27cbdab95df696a769 shipit-source-id: 6fd38cfa3c10012caa2afb27cbdab95df696a769
This commit is contained in:
committed by
Facebook Github Bot 6
parent
3cc4f97f04
commit
44fcf22074
@@ -106,10 +106,10 @@ var JSTimers = {
|
||||
|
||||
clearImmediate: function(timerID) {
|
||||
JSTimers._clearTimerID(timerID);
|
||||
JSTimersExecution.immediates.splice(
|
||||
JSTimersExecution.immediates.indexOf(timerID),
|
||||
1
|
||||
);
|
||||
var index = JSTimersExecution.immediates.indexOf(timerID);
|
||||
if (index !== -1) {
|
||||
JSTimersExecution.immediates.splice(index, 1);
|
||||
}
|
||||
},
|
||||
|
||||
cancelAnimationFrame: function(timerID) {
|
||||
|
||||
Reference in New Issue
Block a user