rem:  var msgHdr = gDBView.hdrForFirstSelectedMessage; 
add:  var msgHdr; try { msgHdr = gDBView.hdrForFirstSelectedMessage; } catch (ex) { return; }  
context: function setTagHeader(){  // it would be nice if we passed in the msg hdr from the back end  var msgHdr = gDBView.hdrForFirstSelectedMessage;  var tagsString = "";    // extract the tags from the msg hdr  var tags = msgHdr.getStringProperty('keywords');    var label = msgHdr.label;  if (label > 0)  {    var labelTag = '$label' + label + '0';    tagsString = encodeURIComponent(gPrefBranch.getComplexValue("mailnews.labels.description." + label,                  Components.interfaces.nsIPrefLocalizedString).data);  }    // now convert the list of tag ids into user presentable strings, separate by commas  var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]                   .getService(Components.interfaces.nsIMsgTagService);  // tokenize the keywords based on ' '  var tagsArray = tags.split(' ');  for (var index = 0; index < tagsArray.length; index++)  {    if (tagsArray[index])    {      var tagName;      try {        // if we got a bad tag name, getTagForKey will throw an exception, skip it         // and go to the next one.        tagName = tagService.getTagForKey(tagsArray[index]);      } catch (ex) { continue; }            if (tagName)      {                  if (tagsString)          tagsString += " ";        tagsString += encodeURIComponent(tagName);      }    }  }    if (tagsString)    currentHeaderData['tags'] = { headerName: 'tags', headerValue: tagsString};  else if (currentHeaderData['tags']) // no more tags, so clear out the header field    currentHeaderData['tags'] = null;}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/15d9859f27bb7fd8d34e6679b167da791b2be643/msgHdrViewOverlay.js/buggy/mail/base/content/msgHdrViewOverlay.js