Bug 1278452 - Move a misplaced null check in layout/forms/. r=mattwoodrow.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 07 Jun 2016 16:21:58 +1000
changeset 301034 d47307c8a3008eb1d1cc37353f8687bbf81e4321
parent 301033 ae2bafad2ec2e5a2de35bce1b5e8939e8d26cff5
child 301035 77a4d658b09a702e656980405e6ec65f557434bc
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1278452
milestone50.0a1
Bug 1278452 - Move a misplaced null check in layout/forms/. r=mattwoodrow.
layout/forms/nsFileControlFrame.cpp
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -150,19 +150,22 @@ nsFileControlFrame::CreateAnonymousConte
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   if (isDirPicker) {
     mBrowseDirs = MakeAnonButton(doc, "ChooseDirs", fileContent, EmptyString());
     // Setting the 'directory' attribute is simply a means of allowing our
     // event handling code in HTMLInputElement.cpp to distinguish between a
     // click on the "Choose files" button from the "Choose a folder" button.
+    if (!mBrowseDirs) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
     mBrowseDirs->SetAttr(kNameSpaceID_None, nsGkAtoms::directory,
                          EmptyString(), false);
-    if (!mBrowseDirs || !aElements.AppendElement(mBrowseDirs)) {
+    if (!aElements.AppendElement(mBrowseDirs)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
   }
 
   // Create and setup the text showing the selected files.
   RefPtr<NodeInfo> nodeInfo;
   nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::label, nullptr,
                                                  kNameSpaceID_XUL,