Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ReactContext: Fail fast when NativeModules thread is null
Summary: By the time that we call [ReactContext.assertOnNativeModulesQueueThread()](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java?commit=747a25280435d276fb975ccfe36fd5e60254c4e4&lines=355%2C359), ReactContext.mNativeModulesMessageQueueThread must be non-null. This implies that two things must have happened: 1. We initialized the ReactContext 2. After initialization, ReactContext.mNativeModulesMessageQueueThread must be non-null. According to T85807990, ReactContext.mNativeModulesMessageQueueThread is null. Since ReactContext doesn't ever write to ReactContext.mNativeModulesMessageQueueThread aside from during initialization, it must mean that we either didn't initialize properly, or we initialized, but set the NativeModules thread to null. This diff throws IllegalStateExceptions inside ReactContext initialization, which should help narrow down the crash in T85807990. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D27729355 fbshipit-source-id: e39030b7db8862ae76fb644efaafb382a79b8ad0
- Loading branch information