diff --git a/content/html/content/src/HTMLInputElement.cpp b/content/html/content/src/HTMLInputElement.cpp
index 3eef461572bc..e93e3c68b016 100644
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -324,6 +324,10 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
nsresult rv = mFilePicker->GetDomfiles(getter_AddRefs(iter));
NS_ENSURE_SUCCESS(rv, rv);
+ if (!iter) {
+ return NS_OK;
+ }
+
nsCOMPtr tmp;
bool prefSaved = false;
bool loop = true;