Commit 5e6f1ed5 authored by Eugene But's avatar Eugene But Committed by Chromium LUCI CQ

[ios] Fix crash in CreateSyntheticCrashReportForUte

CreateSyntheticCrashReportForUte can be legitimately called with empty
breadcrumbs vector, in which case the app should not crash.

This CL uses "No Breadcrumbs" signature instead of trying to access the
element in an empty vector.

Bug: 1154039
Change-Id: I45537944122700c9085c4e824ae9edeafe1c7395
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566361
Commit-Queue: Eugene But <eugenebut@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Auto-Submit: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832199}
parent 619891a2
...@@ -106,8 +106,11 @@ void CreateSyntheticCrashReportForUte( ...@@ -106,8 +106,11 @@ void CreateSyntheticCrashReportForUte(
base::SysInfo::HardwareModelName()); base::SysInfo::HardwareModelName());
AppendConfigWithBreakpadServerParam(config, "breadcrumbs", AppendConfigWithBreakpadServerParam(config, "breadcrumbs",
base::JoinString(breadcrumbs, "\n")); base::JoinString(breadcrumbs, "\n"));
AppendConfigWithBreakpadServerParam(
config, "signature", breadcrumbs.back().substr(strlen("00:00 "))); std::string signature = breadcrumbs.empty()
? "No Breadcrumbs"
: breadcrumbs.back().substr(strlen("00:00 "));
AppendConfigWithBreakpadServerParam(config, "signature", signature);
for (NSString* key in previous_session.reportParameters.allKeys) { for (NSString* key in previous_session.reportParameters.allKeys) {
AppendConfigWithBreakpadServerParam( AppendConfigWithBreakpadServerParam(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment