From 2e186fb37f2a251eed5e338455ef2950fff08ecd Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Sat, 6 Feb 1999 06:09:53 +0000 Subject: [PATCH] fixed error checking for command creation. git-svn-id: svn://10.0.0.236/trunk@19920 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpfe/appshell/src/nsWebShellWindow.cpp | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 59fb7c9fce8..4e0022641f8 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -438,14 +438,13 @@ void nsWebShellWindow::LoadCommands(nsIWebShell * aWebShell, nsIDOMDocument * aD nsIXULCommand * xulCmdInterface = nsnull; rv = nsRepository::CreateInstance(kXULCommandCID, nsnull, kIXULCommandIID, (void**)&xulCmdInterface); - if (NS_OK != rv) { - // Error + if (NS_OK == rv) { + xulCmdInterface->SetName(name);//nsIXULCommand + xulCmdInterface->SetCommand(value);//nsIXULCommand + xulCmdInterface->SetWebShell(aWebShell);// Added to nsIXULCommand + xulCmdInterface->SetDOMElement(element);// Added to nsIXULCommand + mCommands.AppendElement(xulCmdInterface); } - xulCmdInterface->SetName(name);//nsIXULCommand - xulCmdInterface->SetCommand(value);//nsIXULCommand - xulCmdInterface->SetWebShell(aWebShell);// Added to nsIXULCommand - xulCmdInterface->SetDOMElement(element);// Added to nsIXULCommand - mCommands.AppendElement(xulCmdInterface); /* nsXULCommand * xulCmd = new nsXULCommand(); @@ -488,17 +487,16 @@ void nsWebShellWindow::LoadCommands(nsIWebShell * aWebShell, nsIDOMDocument * aD nsIXULCommand * xulCmdInterface = nsnull; rv = nsRepository::CreateInstance(kXULCommandCID, nsnull, kIXULCommandIID, (void**)&xulCmdInterface); - if (NS_OK != rv) { - // Error - } - xulCmdInterface->SetName(name); - xulCmdInterface->SetCommand(value); - xulCmdInterface->SetWebShell(aWebShell); - xulCmdInterface->SetDOMElement(element); + if (NS_OK == rv) { + xulCmdInterface->SetName(name); + xulCmdInterface->SetCommand(value); + xulCmdInterface->SetWebShell(aWebShell); + xulCmdInterface->SetDOMElement(element); - mCommands.AppendElement(xulCmdInterface); + mCommands.AppendElement(xulCmdInterface); - xulCmdInterface->AddUINode(node); + xulCmdInterface->AddUINode(node); + } /* nsXULCommand * xulCmd = new nsXULCommand(); xulCmd->SetName(name);