Bug 1340803 - Make nsMIMEInfoWin::GetPossibleLocalHandlers check fileExt is non-empty before checking its first char. r=jimm
authorHonza Bambas <honzab.moz@firemni.cz>
Sat, 18 Feb 2017 07:31:00 -0500
changeset 373918 f4eae24795b9ae702254e576a1f2c5d8d72c7a60
parent 373917 cc682c2db247433a4aad347f0d20ddbc968eb26b
child 373919 3e552501cd1fc10a5c5e41fdc87c8161453cf8f0
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1340803
milestone54.0a1
Bug 1340803 - Make nsMIMEInfoWin::GetPossibleLocalHandlers check fileExt is non-empty before checking its first char. r=jimm
uriloader/exthandler/win/nsMIMEInfoWin.cpp
--- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp
+++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp
@@ -607,18 +607,19 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(
           CopyUTF16toUTF8(mimeFileExt, fileExt);
           extKnown = false;
         }
       }
     }
   }
 
   nsAutoString fileExtToUse;
-  if (fileExt.First() != '.')
+  if (!fileExt.IsEmpty() && fileExt.First() != '.') {
     fileExtToUse = char16_t('.');
+  }
   fileExtToUse.Append(NS_ConvertUTF8toUTF16(fileExt));
 
   // Note, the order in which these occur has an effect on the 
   // validity of the resulting display list.
 
   if (!extKnown) {
     // 1) Get the default handler if it exists
     workingRegistryPath = fileExtToUse;