diff --git a/src/document/DocumentCommandHandlers.js b/src/document/DocumentCommandHandlers.js index 618ada5adca..28ea9a9dfb0 100644 --- a/src/document/DocumentCommandHandlers.js +++ b/src/document/DocumentCommandHandlers.js @@ -158,8 +158,8 @@ define(function (require, exports, module) { var currentDoc = DocumentManager.getCurrentDocument(), windowTitle = brackets.config.app_title, currentlyViewedFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE), - currentlyViewedPath = currentlyViewedFile.fullPath, - readOnlyString = currentlyViewedFile.readOnly ? "[Read Only] - " : ""; + currentlyViewedPath = currentlyViewedFile && currentlyViewedFile.fullPath, + readOnlyString = (currentlyViewedFile && currentlyViewedFile.readOnly) ? "[Read Only] - " : ""; if (!brackets.nativeMenus) { if (currentlyViewedPath) { diff --git a/src/extensions/default/RemoteFileAdapter/main.js b/src/extensions/default/RemoteFileAdapter/main.js index 143e7ff3c75..5feca37ce8b 100644 --- a/src/extensions/default/RemoteFileAdapter/main.js +++ b/src/extensions/default/RemoteFileAdapter/main.js @@ -59,7 +59,8 @@ define(function (require, exports, module) { function _setMenuItemsVisible() { var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE), cMenuItems = [Commands.FILE_SAVE, Commands.FILE_RENAME, Commands.NAVIGATE_SHOW_IN_FILE_TREE, Commands.NAVIGATE_SHOW_IN_OS], - enable = (file.constructor.name !== "RemoteFile"); + // Enable menu options when no file is present in active pane + enable = !file || (file.constructor.name !== "RemoteFile"); // Enable or disable commands based on whether the file is a remoteFile or not. cMenuItems.forEach(function (item) { diff --git a/src/search/FindBar.js b/src/search/FindBar.js index d15cdd7fe93..e655b6b763e 100644 --- a/src/search/FindBar.js +++ b/src/search/FindBar.js @@ -705,7 +705,7 @@ define(function (require, exports, module) { */ FindBar.getInitialQuery = function (currentFindBar, editor) { var query, - selection = FindBar._getInitialQueryFromSelection(editor), + selection = editor ? FindBar._getInitialQueryFromSelection(editor) : "", replaceText = ""; if (currentFindBar && !currentFindBar.isClosed()) {