Bug 474369 - get rid of nsVoidArray, uninitialized warning fix; r+sr=sicking
authorArpad Borsos <arpad.borsos@googlemail.com>
Sat, 21 Mar 2009 09:32:16 +0100
changeset 26443 d14de45019a01316033e39112a58ae33fcd6ea0a
parent 26442 c2dad7721eea96744f05433dcba601a4b59c972a
child 26444 8d17fb3a61978db5ba03efe14d01819ea6f11e58
push id6070
push userarpad.borsos@googlemail.com
push dateSat, 21 Mar 2009 09:51:50 +0000
treeherdermozilla-central@d14de45019a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs474369
milestone1.9.2a1pre
Bug 474369 - get rid of nsVoidArray, uninitialized warning fix; r+sr=sicking
content/svg/content/src/nsSVGNumberList.cpp
--- a/content/svg/content/src/nsSVGNumberList.cpp
+++ b/content/svg/content/src/nsSVGNumberList.cpp
@@ -368,29 +368,29 @@ nsSVGNumberList::RemoveElementAt(PRInt32
   mNumbers.RemoveElementAt(index);
   NS_RELEASE(number);
   DidModify();
 }
 
 nsresult
 nsSVGNumberList::InsertElementAt(nsIDOMSVGNumber* aElement, PRInt32 index)
 {
-  nsresult rv;
-  WillModify();
-  NS_ADDREF(aElement);
-
   // The SVG specs state that 'if newItem is already in a list, it
   // is removed from its previous list before it is inserted into this
   // list':
   //  aElement->SetListOwner(this);
   
-  if (mNumbers.InsertElementAt(index, aElement))
-    NS_ADD_SVGVALUE_OBSERVER(aElement);
+  if (!mNumbers.InsertElementAt(index, aElement)) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+  WillModify();
+  NS_ADDREF(aElement);
+  NS_ADD_SVGVALUE_OBSERVER(aElement);
   DidModify();
-  return rv;
+  return NS_OK;
 }
 
 
 ////////////////////////////////////////////////////////////////////////
 // Exported creation functions:
 
 nsresult
 NS_NewSVGNumberList(nsIDOMSVGNumberList** result)