Fix crash if getting pending crash report fails

This commit is contained in:
Shadowfacts 2022-04-08 18:45:09 -04:00
parent 4f99d3c6e1
commit a718721537
1 changed files with 3 additions and 4 deletions

View File

@ -34,11 +34,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let config = PLCrashReporterConfig(signalHandlerType: .BSD, symbolicationStrategy: .all)
AppDelegate.crashReporter = PLCrashReporter(configuration: config)
if AppDelegate.crashReporter.hasPendingCrashReport() {
let data = try! AppDelegate.crashReporter.loadPendingCrashReportDataAndReturnError()
if AppDelegate.crashReporter.hasPendingCrashReport(),
let data = try? AppDelegate.crashReporter.loadPendingCrashReportDataAndReturnError(),
let report = try? PLCrashReport(data: data) {
AppDelegate.crashReporter.purgePendingCrashReport()
let report = try! PLCrashReport(data: data)
AppDelegate.pendingCrashReport = report
}