Bug 1278452 - Avoid a null deref in dom/events/. r=mccr8.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 07 Jun 2016 16:03:34 +1000
changeset 301031 2202233b5b183143c85ab7a65b84a90003c262b3
parent 301030 45ea273f14d1f1e17c352d7a5df4f1deff43283e
child 301032 cf7ac0a043f9d45fc4c852e26d1d59e4d1ee7468
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)
reviewersmccr8
bugs1278452
milestone50.0a1
Bug 1278452 - Avoid a null deref in dom/events/. r=mccr8.
dom/events/IMEStateManager.cpp
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -1024,19 +1024,20 @@ IMEStateManager::SetIMEState(const IMESt
     nsIContent* inputContent = aContent->FindFirstNonChromeOnlyAccessContent();
 
     // If we don't have an action hint and
     // return won't submit the form, use "next".
     if (context.mActionHint.IsEmpty() &&
         inputContent->IsHTMLElement(nsGkAtoms::input)) {
       bool willSubmit = false;
       nsCOMPtr<nsIFormControl> control(do_QueryInterface(inputContent));
-      mozilla::dom::Element* formElement = control->GetFormElement();
+      mozilla::dom::Element* formElement = nullptr;
       nsCOMPtr<nsIForm> form;
       if (control) {
+        formElement = control->GetFormElement();
         // is this a form and does it have a default submit element?
         if ((form = do_QueryInterface(formElement)) &&
             form->GetDefaultSubmitElement()) {
           willSubmit = true;
         // is this an html form and does it only have a single text input element?
         } else if (formElement && formElement->IsHTMLElement(nsGkAtoms::form) &&
                    !static_cast<dom::HTMLFormElement*>(formElement)->
                      ImplicitSubmissionIsDisabled()) {