diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 8300ac19c722..cb28a0c1465f 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -1624,16 +1624,16 @@ nsGenericHTMLElement::RestoreFormControlState(nsGenericHTMLElement* aContent, { nsCOMPtr history; nsCAutoString key; - nsresult rv = GetLayoutHistoryAndKey(aContent, true, - getter_AddRefs(history), key); + GetLayoutHistoryAndKey(aContent, true, + getter_AddRefs(history), key); if (!history) { return false; } nsPresState *state; // Get the pres state for this key - rv = history->GetState(key, &state); - if (state) { + nsresult rv = history->GetState(key, &state); + if (NS_SUCCEEDED(rv) && state) { bool result = aControl->RestoreState(state); history->RemoveState(key); return result;