| Index: ui/base/win/open_file_name_win.cc
|
| diff --git a/ui/base/win/open_file_name_win.cc b/ui/base/win/open_file_name_win.cc
|
| index 5b78a8e465198fd5376da96af3bcc7b4bd0dc625..3914fa5cfae43951dc8ace26a60bf10565df7345 100644
|
| --- a/ui/base/win/open_file_name_win.cc
|
| +++ b/ui/base/win/open_file_name_win.cc
|
| @@ -151,10 +151,19 @@ void OpenFileName::GetResult(base::FilePath* directory,
|
| std::vector<base::FilePath>* filenames) {
|
| DCHECK(filenames->empty());
|
| const wchar_t* selection = openfilename_.lpstrFile;
|
| - while (*selection) { // Empty string indicates end of list.
|
| + // The return value of |openfilename_.lpstrFile| is dependent on the
|
| + // value of the Multi-Select flag within |openfilename_|. If the flag is
|
| + // not set the return value will be a single null-terminated wide string.
|
| + // If it is set it will be more than one null-terminated wide string, itself
|
| + // terminated by an empty null-terminated wide string.
|
| + if (openfilename_.Flags & OFN_ALLOWMULTISELECT) {
|
| + while (*selection) { // Empty string indicates end of list.
|
| + filenames->push_back(base::FilePath(selection));
|
| + // Skip over filename and null-terminator.
|
| + selection += filenames->back().value().length() + 1;
|
| + }
|
| + } else {
|
| filenames->push_back(base::FilePath(selection));
|
| - // Skip over filename and null-terminator.
|
| - selection += filenames->back().value().length() + 1;
|
| }
|
| if (filenames->size() == 1) {
|
| // When there is one file, it contains the path and filename.
|
|
|