diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java index 79a5b6b3f..91a6ddc7c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java @@ -241,12 +241,17 @@ public final class Timing extends ReactContextBaseJavaModule implements Lifecycl @ReactMethod public void deleteTimer(ExecutorToken executorToken, int timerId) { synchronized (mTimerGuard) { - Timer timer = mTimerIdsToTimers.get(executorToken).get(timerId); - if (timer != null) { - // We may have already called/removed it - mTimerIdsToTimers.remove(timerId); - mTimers.remove(timer); + SparseArray timersForContext = mTimerIdsToTimers.get(executorToken); + if (timersForContext == null) { + return; } + Timer timer = timersForContext.get(timerId); + if (timer == null) { + return; + } + // We may have already called/removed it + mTimerIdsToTimers.remove(timerId); + mTimers.remove(timer); } } }