Permalink
Browse files

Fix crash in `RCTRedBox::formatFrameSource:`

Summary:
Motivation: Similar to #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 #13360

Differential Revision: D4848980

Pulled By: javache

fbshipit-source-id: dc506f2ba39c2d4d68982b56a6e765a19dc048b0
  • Loading branch information...
terribleben authored and ide committed Apr 7, 2017
1 parent 8c99cc4 commit 1a23902c604b7c4fe394fe998a98470b181c640c
Showing with 2 additions and 1 deletion.
  1. +2 −1 React/Modules/RCTRedBox.m
@@ -185,8 +185,9 @@ - (void)copyStack
- (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) {

0 comments on commit 1a23902

Please sign in to comment.