mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix crash in RCTExceptionManager (#54550)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54550 # Summary This diff resolves a crash in RCTExceptionManager by modifying error handling. It fixes the issue by checking if `RCTJSExtraDataKey` and `RCTJSStackTraceKey` are null or not in a dictionary initializer. Also, `RCTJSExtraDataKey` is marked as nullable but its nullability is not checked. ## Changelog: [iOS][Fixed] - A Crash when some error information are nil Reviewed By: javache Differential Revision: D87140823 fbshipit-source-id: 896d41c5f6559206a6515e402d2a503df6ddb63c
This commit is contained in:
1 parent
8b6b47bd57
commit
efd2f679f2
1 file changed
+5
-2
@@ -77,8 +77,11 @@ RCT_EXPORT_MODULE()
|
||||
RCTTriggerReloadCommandListeners(@"JS Crash Reload");
|
||||
} else if (!RCT_DEV) {
|
||||
NSString *description = [@"Unhandled JS Exception: " stringByAppendingString:message];
|
||||
NSDictionary *errorInfo =
|
||||
@{NSLocalizedDescriptionKey : description, RCTJSStackTraceKey : stack, RCTJSExtraDataKey : extraDataAsJSON};
|
||||
NSDictionary *errorInfo = @{
|
||||
NSLocalizedDescriptionKey : description,
|
||||
RCTJSStackTraceKey : stack == nil ? (id)kCFNull : stack,
|
||||
RCTJSExtraDataKey : extraDataAsJSON == nil ? (id)kCFNull : extraDataAsJSON
|
||||
};
|
||||
RCTFatal([NSError errorWithDomain:RCTErrorDomain code:0 userInfo:errorInfo]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user