Bug 880042 - file[multiple] form field nsIFilePicker crash if overriding component has not implemented a domfiles getter. r=smaug, a=akeybl
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 11 Jun 2013 15:09:49 -0400
changeset 137780 c7ae9b066608fb1d46642bf88b600c28e4dcf5bd
parent 137779 4cdd817a97b846f6426341b92e267a8bfb70c4d7
child 137781 60778e5f049811f44d8ac4106d714c60356edc64
child 137783 7af2b98bd245eb3ba03b82f94630915540e27a45
child 137785 d0a27a8a2ccd70f043f8ef3f5c1d8bed95ed7979
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewerssmaug, akeybl
bugs880042
milestone22.0
Bug 880042 - file[multiple] form field nsIFilePicker crash if overriding component has not implemented a domfiles getter. r=smaug, a=akeybl
content/html/content/src/HTMLInputElement.cpp
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -311,16 +311,20 @@ HTMLInputElement::nsFilePickerShownCallb
 
   // Collect new selected filenames
   nsCOMArray<nsIDOMFile> newFiles;
   if (mMulti) {
     nsCOMPtr<nsISimpleEnumerator> iter;
     nsresult rv = mFilePicker->GetDomfiles(getter_AddRefs(iter));
     NS_ENSURE_SUCCESS(rv, rv);
 
+    if (!iter) {
+      return NS_OK;
+    }
+
     nsCOMPtr<nsISupports> tmp;
     bool prefSaved = false;
     bool loop = true;
 
     while (NS_SUCCEEDED(iter->HasMoreElements(&loop)) && loop) {
       iter->GetNext(getter_AddRefs(tmp));
       nsCOMPtr<nsIDOMFile> domFile = do_QueryInterface(tmp);
       MOZ_ASSERT(domFile);