From bb2237662e27e4a36d5368896dbe6a884429d0a3 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Mon, 5 Apr 2004 21:59:53 +0000 Subject: [PATCH] Bug #239741 --> Unable to forward messages. regression caused by my earlier checkin to AddAttachment --- .../compose/content/MsgComposeCommands.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mail/components/compose/content/MsgComposeCommands.js b/mail/components/compose/content/MsgComposeCommands.js index eea952e8e3a3..06658288edef 100644 --- a/mail/components/compose/content/MsgComposeCommands.js +++ b/mail/components/compose/content/MsgComposeCommands.js @@ -2317,17 +2317,27 @@ function AddAttachment(attachment) item.setAttribute("class", "listitem-iconic"); var url = gIOService.newURI(attachment.url, null, null); - url = url.QueryInterface( Components.interfaces.nsIURL ); + + try + { + url = url.QueryInterface( Components.interfaces.nsIURL ); + } + catch (ex) + { + url = null; + } + // for local file urls, we are better off using the full file url because moz-icon will // actually resolve the file url and get the right icon from the file url. All other urls, we should // try to extract the file name from them. This fixes issues were an icon wasn't showing up if you dragged // a web url that had a query or reference string after the file name and for mailnews urls were the filename // is hidden in the url as a &filename= part. - if (url.fileName && !url.schemeIs("file")) + if (url && url.fileName && !url.schemeIs("file")) item.setAttribute("image", "moz-icon://" + url.fileName); else item.setAttribute("image", "moz-icon:" + attachment.url); + bucket.appendChild(item); } }