summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 17:20:12 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 17:20:12 +0000
commitc65bf2ab6d7b14070b6fcfef1f4e20a42768e3f3 (patch)
treebfbfeb79f3f9a2836323cccd9cd55fa9b93426a5
parentfaaddbb524fc2a6b54bb50f8e96cfba09103af98 (diff)
downloadchromium_src-c65bf2ab6d7b14070b6fcfef1f4e20a42768e3f3.zip
chromium_src-c65bf2ab6d7b14070b6fcfef1f4e20a42768e3f3.tar.gz
chromium_src-c65bf2ab6d7b14070b6fcfef1f4e20a42768e3f3.tar.bz2
Merge 264161 "Fix crash in GetCandidateIndicesWithBestScores() w..."
> Fix crash in GetCandidateIndicesWithBestScores() when |candidate_sizes| is empty > > BUG=361516 > TEST=Crash stops occurring > > Review URL: https://codereview.chromium.org/239343005 TBR=pkotwicz@chromium.org Review URL: https://codereview.chromium.org/246803004 git-svn-id: svn://svn.chromium.org/chrome/branches/1916/src@265293 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/history/select_favicon_frames.cc3
-rw-r--r--chrome/browser/ui/web_applications/web_app_ui.cc14
2 files changed, 11 insertions, 6 deletions
diff --git a/chrome/browser/history/select_favicon_frames.cc b/chrome/browser/history/select_favicon_frames.cc
index 43a1fa4..ef7ac79 100644
--- a/chrome/browser/history/select_favicon_frames.cc
+++ b/chrome/browser/history/select_favicon_frames.cc
@@ -143,7 +143,8 @@ void GetCandidateIndicesWithBestScores(
float* match_score,
std::vector<SelectionResult>* results) {
if (candidate_sizes.empty()) {
- *match_score = 0.0f;
+ if (match_score)
+ *match_score = 0.0f;
return;
}
diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc
index 8a5bf2a..baa6851 100644
--- a/chrome/browser/ui/web_applications/web_app_ui.cc
+++ b/chrome/browser/ui/web_applications/web_app_ui.cc
@@ -214,15 +214,19 @@ void UpdateShortcutWorker::DidDownloadFavicon(
requested_size,
&closest_indices,
NULL);
- size_t closest_index = closest_indices[0];
- if (!bitmaps.empty() && !bitmaps[closest_index].isNull()) {
+ SkBitmap bitmap;
+ if (!bitmaps.empty()) {
+ size_t closest_index = closest_indices[0];
+ bitmap = bitmaps[closest_index];
+ }
+
+ if (!bitmap.isNull()) {
// Update icon with download image and update shortcut.
- shortcut_info_.favicon.Add(
- gfx::Image::CreateFrom1xBitmap(bitmaps[closest_index]));
+ shortcut_info_.favicon.Add(gfx::Image::CreateFrom1xBitmap(bitmap));
extensions::TabHelper* extensions_tab_helper =
extensions::TabHelper::FromWebContents(web_contents_);
- extensions_tab_helper->SetAppIcon(bitmaps[closest_index]);
+ extensions_tab_helper->SetAppIcon(bitmap);
UpdateShortcuts();
} else {
// Try the next icon otherwise.