Fix crash in `RCTRedBox::formatFrameSource:`
Summary: Motivation: Similar to https://github.com/facebook/react-native/pull/13242 - the application will crash with `[NSNull lastPathComponent]: unrecognized selector sent to instance` if a stack frame with no filename makes it to RCTRedBox. Closes https://github.com/facebook/react-native/pull/13360 Differential Revision: D4848980 Pulled By: javache fbshipit-source-id: dc506f2ba39c2d4d68982b56a6e765a19dc048b0
This commit is contained in:
parent
39431deb1f
commit
540f4c9638
|
@ -185,8 +185,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
|||
|
||||
- (NSString *)formatFrameSource:(RCTJSStackFrame *)stackFrame
|
||||
{
|
||||
NSString *fileName = RCTNilIfNull(stackFrame.file) ? [stackFrame.file lastPathComponent] : @"<unknown file>";
|
||||
NSString *lineInfo = [NSString stringWithFormat:@"%@:%zd",
|
||||
[stackFrame.file lastPathComponent],
|
||||
fileName,
|
||||
stackFrame.lineNumber];
|
||||
|
||||
if (stackFrame.column != 0) {
|
||||
|
|
Loading…
Reference in New Issue