From 72579f9bab03a3802d523c074c21d220ae2ba05e Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Tue, 13 Mar 2018 13:57:12 -0700 Subject: [PATCH] :wrench: Sort crashes --- lib/common/api/crash-reporter.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/common/api/crash-reporter.js b/lib/common/api/crash-reporter.js index 6dc774049def..69962ddd6aed 100644 --- a/lib/common/api/crash-reporter.js +++ b/lib/common/api/crash-reporter.js @@ -65,6 +65,12 @@ class CrashReporter { getLastCrashReport () { const reports = this.getUploadedReports() + .sort((a, b) => { + const ats = (a && a.timestamp) ? new Date(a.timestamp).getTime() : 0 + const bts = (b && b.timestamp) ? new Date(b.timestamp).getTime() : 0 + return bts - ats + }) + return (reports.length > 0) ? reports[0] : null }