diff --git a/mailnews/base/resources/content/mail3PaneWindowCommands.js b/mailnews/base/resources/content/mail3PaneWindowCommands.js index 84212ab21ccb..d343d779be07 100644 --- a/mailnews/base/resources/content/mail3PaneWindowCommands.js +++ b/mailnews/base/resources/content/mail3PaneWindowCommands.js @@ -859,7 +859,10 @@ function IsRenameFolderEnabled() function IsCanSearchMessagesEnabled() { - var folder = GetMsgFolderFromUri(GetSelectedFolderURI(), false); + var folderURI = GetSelectedFolderURI(); + if (!folderURI) + return false; + var folder = GetMsgFolderFromUri(folderURI, false); var isVirtualFolder = folder.flags & MSG_FOLDER_FLAG_VIRTUAL; return folder.server.canSearchMessages && !isVirtualFolder; }