diff --git a/React/Modules/RCTRedBox.m b/React/Modules/RCTRedBox.m index 7d7b47b49ef2..c8003bc6d704 100644 --- a/React/Modules/RCTRedBox.m +++ b/React/Modules/RCTRedBox.m @@ -185,8 +185,9 @@ - (void)copyStack - (NSString *)formatFrameSource:(RCTJSStackFrame *)stackFrame { + NSString *fileName = RCTNilIfNull(stackFrame.file) ? [stackFrame.file lastPathComponent] : @""; NSString *lineInfo = [NSString stringWithFormat:@"%@:%zd", - [stackFrame.file lastPathComponent], + fileName, stackFrame.lineNumber]; if (stackFrame.column != 0) {