Skip to content

Commit

Permalink
Fix crash in RCTRedBox::formatFrameSource:
Browse files Browse the repository at this point in the history
Summary:
Motivation: Similar to facebook#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 facebook#13360

Differential Revision: D4848980

Pulled By: javache

fbshipit-source-id: dc506f2ba39c2d4d68982b56a6e765a19dc048b0
  • Loading branch information
terribleben authored and ide committed Apr 7, 2017
1 parent 11f16eb commit 6cb80ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion React/Modules/RCTRedBox.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6cb80ea

Please sign in to comment.