Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / web_applications / web_app_ui.cc
index 8a5bf2a..baa6851 100644 (file)
@@ -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.