Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Unified Diff: chrome/browser/chromeos/login/wallpaper_manager.cc

Issue 271853002: Allow debug configurations of stub users when wallpaper info may be absent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/wallpaper_manager.cc
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc
index 55cd1998a4a5e980ca0a06d03702ac784270536a..25e5c494b14c717078bd46044e50895c1f295f8b 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -24,6 +24,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "base/sys_info.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -1333,6 +1334,24 @@ void WallpaperManager::LoadWallpaper(const std::string& user_id,
MovableOnDestroyCallbackHolder on_finish) {
base::FilePath wallpaper_dir;
base::FilePath wallpaper_path;
+
+ // Do a sanity check that file path information is not empty.
+ if (info.type == User::ONLINE || info.type == User::DEFAULT) {
+ if (info.file.empty()) {
+ if (base::SysInfo::IsRunningOnChromeOS()) {
+ NOTREACHED() << "User wallpaper info appears to be broken: " << user_id;
+ } else {
+ // Filename might be empty on debug configurations when stub users
+ // were created directly in Local State (for testing). Ignore such
+ // errors i.e. allowsuch type of debug configurations on the desktop.
+ LOG(WARNING) << "User wallpaper info is empty: " << user_id;
+
+ // |on_finish| callback will get called on destruction.
+ return;
+ }
+ }
+ }
+
if (info.type == User::ONLINE) {
std::string file_name = GURL(info.file).ExtractFileName();
WallpaperResolution resolution = GetAppropriateResolution();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698