diff --git a/mailnews/base/resources/content/msgMail3PaneWindow.js b/mailnews/base/resources/content/msgMail3PaneWindow.js index b1a7854d1f7f..39dc5f3f762c 100644 --- a/mailnews/base/resources/content/msgMail3PaneWindow.js +++ b/mailnews/base/resources/content/msgMail3PaneWindow.js @@ -1075,7 +1075,16 @@ function GetFirstSelectedMessage() // Use this instead of gDBView.URIForFirstSelectedMessage, else it // will return the currentIndex message instead of the highlighted // message. - return GetSelectedMessages()[0]; + // + // note, there may not be any selected messages + // + // XXX todo + // is this inefficient when we've got a lot of message selected? + var selectedMessages = GetSelectedMessages(); + if (selectedMessages) + return selectedMessages[0]; + else + return null; } catch (ex) { return null;