Bug 1581253 - Don't call getURLSpecFromFile(null) when no photo file is specified. r=me
authorJorg K <jorgk@jorgk.com>
Sun, 15 Sep 2019 00:18:33 +0200
changeset 36816 ba0d11f51d765208d20e47d9601889507f84df18
parent 36815 5b0b472c4a7acc74d53c2eb1d4e86d6ffb64924f
child 36817 dbe658106fe71de890c9f5b6735ee024b22e7baa
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersme
bugs1581253
Bug 1581253 - Don't call getURLSpecFromFile(null) when no photo file is specified. r=me
mail/components/addrbook/content/abCard.js
--- a/mail/components/addrbook/content/abCard.js
+++ b/mail/components/addrbook/content/abCard.js
@@ -1320,21 +1320,21 @@ var filePhotoHandler = {
       aCard.setProperty("PhotoURI", photoURI);
     }
     return true;
   },
 
   _showFilename(aCard, aDocument) {
     let photoElem = aDocument.getElementById("PhotoFile");
     let photoFile = photoElem.file ? photoElem.file : null;
-    let photoSpec = Services.io
-      .getProtocolHandler("file")
-      .QueryInterface(Ci.nsIFileProtocolHandler)
-      .getURLSpecFromFile(photoFile);
     if (photoFile) {
+      let photoSpec = Services.io
+        .getProtocolHandler("file")
+        .QueryInterface(Ci.nsIFileProtocolHandler)
+        .getURLSpecFromFile(photoFile);
       photoElem.style.backgroundImage =
         "url(moz-icon://" + photoSpec + "?size=16)";
       photoElem.value = photoFile.leafName;
     } else {
       photoElem.value = "";
     }
   },
 };