Commit 4e039309 authored by hidehiko@chromium.org's avatar hidehiko@chromium.org

Fix potential SEGV issue.

DriveIntegrationServiceFactory::GetForProfile may return NULL, if the Drive
is disabled, so ->file_system() can be SEGV error. This CL replaces it by
drive::util::GetFileSystemByProfile and handles cases that NULL is returned.

BUG=284972
TEST=Ran unit_tests

Review URL: https://chromiumcodereview.appspot.com/23739006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221634 0039d316-1c4b-4281-b951-d872f2087c98
parent 50fd9589
......@@ -62,7 +62,6 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/login/user_manager.h"
......@@ -582,8 +581,12 @@ void FeedbackHandler::GetMostRecentScreenshotsDrive(
const base::FilePath& filepath, std::vector<std::string>* saved_screenshots,
size_t max_saved, base::Closure callback) {
drive::FileSystemInterface* file_system =
drive::DriveIntegrationServiceFactory::GetForProfile(
Profile::FromWebUI(web_ui()))->file_system();
drive::util::GetFileSystemByProfile(Profile::FromWebUI(web_ui()));
if (!file_system) {
callback.Run();
return;
}
file_system->ReadDirectoryByPath(
drive::util::ExtractDrivePath(filepath),
base::Bind(&ReadDirectoryCallback, max_saved, saved_screenshots,
......
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