nsCOMPtr<nsIPresShell> presShell; childAsShell->GetPresShell(getter_AddRefs(presShell));  if (!presShell) { continue; }
DocumentViewerImpl::BuildDocTree(nsIDocShellTreeNode * aParentNode,                                  nsVoidArray *         aDocList,                                  PrintObject *         aPO){  NS_ASSERTION(aParentNode, "Pointer is null!");  NS_ASSERTION(aDocList, "Pointer is null!");  NS_ASSERTION(aPO, "Pointer is null!");  // Get the Doc and Title String  GetWebShellTitleAndURL(aPO->mWebShell, &aPO->mDocTitle, &aPO->mDocURL);   PRInt32 childWebshellCount;  aParentNode->GetChildCount(&childWebshellCount);  if (childWebshellCount > 0) {    for (PRInt32 i=0;i<childWebshellCount;i++) {      nsCOMPtr<nsIDocShellTreeItem> child;      aParentNode->GetChildAt(i, getter_AddRefs(child));      nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));      nsCOMPtr<nsIContentViewer>  viewer;      childAsShell->GetContentViewer(getter_AddRefs(viewer));      if (viewer) {        nsCOMPtr<nsIContentViewerFile> viewerFile(do_QueryInterface(viewer));        if (viewerFile) {          nsCOMPtr<nsIWebShell> childWebShell(do_QueryInterface(child));          nsCOMPtr<nsIDocShellTreeNode> childNode(do_QueryInterface(child));          PrintObject * po = new PrintObject;          po->mWebShell = childWebShell;          po->mParent   = aPO;          aPO->mKids.AppendElement(po);          aDocList->AppendElement(po);          BuildDocTree(childNode, aDocList, po);        }      }    }  }}