Skip to content

Commit

Permalink
Don't call GURL::spec() if the instance isn't valid.
Browse files Browse the repository at this point in the history
This code path trips NOTREACHED in GURL::spec(). This fix preserves
the current behavior if NOTREACHED is a no-op.

(cherry picked from commit ffebb29)

Bug: 1451357
Change-Id: If50500efe814da93be4fa62f668d2f7a2bb1404f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4756089
Commit-Queue: John Lee <johntlee@chromium.org>
Reviewed-by: John Lee <johntlee@chromium.org>
Auto-Submit: David Bertoni <dbertoni@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1181142}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4814297
Auto-Submit: Daniel Yip <danielyip@google.com>
Owners-Override: Daniel Yip <danielyip@google.com>
Commit-Queue: Srinivas Sista <srinivassista@chromium.org>
Reviewed-by: Srinivas Sista <srinivassista@chromium.org>
Cr-Commit-Position: refs/branch-heads/5845@{#1617}
Cr-Branched-From: 5a5dff6-refs/heads/main@{#1160321}
  • Loading branch information
David Bertoni authored and Chromium LUCI CQ committed Aug 25, 2023
1 parent 702b9eb commit 00e98d7
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ void StartupPagesHandler::OnModelChanged() {
for (size_t i = 0; i < page_count; ++i) {
base::Value::Dict entry;
entry.Set("title", startup_custom_pages_table_model_.GetText(i, 0));
entry.Set("url", urls[i].spec());
std::string spec;
if (urls[i].is_valid()) {
spec = urls[i].spec();
}
entry.Set("url", std::move(spec));
entry.Set("tooltip", startup_custom_pages_table_model_.GetTooltip(i));
entry.Set("modelIndex", base::checked_cast<int>(i));
startup_pages.Append(std::move(entry));
Expand Down

0 comments on commit 00e98d7

Please sign in to comment.