From 1511d8ca1db69b9347b9b3f7626c9e7f8a6746ad Mon Sep 17 00:00:00 2001 From: Patrik Tomas Chamelo Date: Fri, 16 Oct 2015 12:12:44 -0700 Subject: [PATCH] Invoking devMenu from RCTBridge in prod will crash Summary: While we shouldn't invoke `bridge.devMenu` in production, doing it will result into a crash. 1. `devMenu` internally calls `RCTBridgeModuleNameForClass([RCTDevMenu class])` 2. `RCTBridgeModuleNameForClass()` calls `moduleName` 3. In the release code `RCTDevMenu` doesn't export the `moduleName` class method. Closes https://github.com/facebook/react-native/pull/2910 Reviewed By: svcscm Differential Revision: D2550797 Pulled By: tadeuzagallo fb-gh-sync-id: 5dfbf905e5a02d9fd3b52f8b3d6eefc4e3ff30b2 --- React/Modules/RCTDevMenu.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/React/Modules/RCTDevMenu.m b/React/Modules/RCTDevMenu.m index 6f03aea32..db24baf0a 100644 --- a/React/Modules/RCTDevMenu.m +++ b/React/Modules/RCTDevMenu.m @@ -623,7 +623,11 @@ RCT_EXPORT_METHOD(reload) - (RCTDevMenu *)devMenu { +#if RCT_DEV return self.modules[RCTBridgeModuleNameForClass([RCTDevMenu class])]; +#else + return nil; +#endif } @end