We've moved the 
o1 = TreeView.NodesXmlDoc.documentElement.childNodes.item(o0 - 1);
into the try-catch block some lines higher. It actually was created for catching the printing preview, but it seems that sometimes it fails (your case).
Here's a code (obfuscated though):
 try
 {
 if (typeof(TreeView.keyEscape) == "undefined") return;
 o1 = TreeView.NodesXmlDoc.documentElement.childNodes.item(o0 - 1);
 }
 catch(e){ return; }