Index: chrome/browser/resources/file_manager/js/file_manager.js |
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js |
index fd9b0c0cb59f5e3d08fa7af1f17f6b5a3b4fe8b8..fa4fbcbb8915a941a97349f9dbbfdbfb7da6231f 100644 |
--- a/chrome/browser/resources/file_manager/js/file_manager.js |
+++ b/chrome/browser/resources/file_manager/js/file_manager.js |
@@ -2922,15 +2922,18 @@ FileManager.prototype = { |
if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER) { |
// In SELECT_FOLDER mode, we allow to select current directory |
// when nothing is selected. |
- selectable = this.selection.directoryCount <= 1 && |
- this.selection.fileCount == 0; |
+ selectable = this.selection && |
+ this.selection.directoryCount <= 1 && |
+ this.selection.fileCount == 0; |
} else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { |
- selectable = (this.isSelectionAvailable() && |
+ selectable = (this.selection && |
+ this.isSelectionAvailable() && |
this.selection.directoryCount == 0 && |
this.selection.fileCount == 1); |
} else if (this.dialogType_ == |
FileManager.DialogType.SELECT_OPEN_MULTI_FILE) { |
- selectable = (this.isSelectionAvailable() && |
+ selectable = (this.selection && |
+ this.isSelectionAvailable() && |
this.selection.directoryCount == 0 && |
this.selection.fileCount >= 1); |
} else if (this.dialogType_ == FileManager.DialogType.SELECT_SAVEAS_FILE) { |