diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp
index 02dc6775e22..808495bd7e8 100644
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -932,11 +932,7 @@ nsHTMLFormElement::SubmitSubmission(nsIFormSubmission* aFormSubmission)
// If there is no link handler, then we won't actually be able to submit.
nsIDocument* doc = GetCurrentDoc();
- if (!doc) {
- // Nothing to do
- }
-
- nsCOMPtr container = doc->GetContainer();
+ nsCOMPtr container = doc ? doc->GetContainer() : nsnull;
nsCOMPtr linkHandler(do_QueryInterface(container));
if (!linkHandler) {
mIsSubmitting = PR_FALSE;