Skip to content

Commit 9c8637e

Browse files
authored
Update path determination (#9198)
1 parent fa4c1e6 commit 9c8637e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Crashlytics/Crashlytics/Controllers/FIRCLSMetricKitManager.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,21 @@ - (BOOL)processMetricKitPayload:(MXDiagnosticPayload *)diagnosticPayload
146146
// Also ensure that there is a report from the last run of the app that we can write to.
147147
NSString *metricKitFatalReportFile;
148148
NSString *metricKitNonfatalReportFile;
149+
149150
NSString *newestUnsentReportID =
150-
[self.existingReportManager.newestUnsentReport.reportID stringByAppendingString:@"/"];
151+
self.existingReportManager.newestUnsentReport.reportID
152+
? [self.existingReportManager.newestUnsentReport.reportID stringByAppendingString:@"/"]
153+
: nil;
151154
NSString *currentReportID =
152155
[_managerData.executionIDModel.executionID stringByAppendingString:@"/"];
153-
BOOL fatal = ([diagnosticPayload.crashDiagnostics count] > 0) && (newestUnsentReportID != nil) &&
154-
([self.fileManager
155-
fileExistsAtPath:[activePath stringByAppendingString:newestUnsentReportID]]);
156+
BOOL crashlyticsFatalReported =
157+
([diagnosticPayload.crashDiagnostics count] > 0) && (newestUnsentReportID != nil) &&
158+
([self.fileManager
159+
fileExistsAtPath:[activePath stringByAppendingString:newestUnsentReportID]]);
156160

157161
// Set the MetricKit fatal path appropriately depending on whether we also captured a Crashlytics
158162
// fatal event and whether the diagnostic report came from a fatal or nonfatal event.
159-
if (fatal) {
163+
if (crashlyticsFatalReported) {
160164
metricKitFatalReportFile = [[activePath stringByAppendingString:newestUnsentReportID]
161165
stringByAppendingString:FIRCLSMetricKitFatalReportFile];
162166
} else {

0 commit comments

Comments
 (0)