Bug 800329 - Check for value before checking its contents. r=ted
authorAxel Hecht <l10n@mozilla.com>
Sat, 13 Oct 2012 04:37:15 -0400
changeset 114776 057589f16a3acda5898755666999df67bc9f7a37
parent 114775 eaffa9d2341ea5b92c68951d8cda4cb1004b0bbd
child 114777 d0f744425ce0d42b765dd92a9df4df6a52ddc8ad
push idunknown
push userunknown
push dateunknown
reviewersted
bugs800329
milestone19.0a1
Bug 800329 - Check for value before checking its contents. r=ted
toolkit/mozapps/installer/windows/nsis/preprocess-locale.py
--- a/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py
+++ b/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py
@@ -40,17 +40,17 @@ def get_locale_strings(path, prefix, mid
     fp = open(path, "r")
     for line in fp:
         line = line.strip()
         if line == "" or line[0] == "#":
             continue
 
         name, value = line.split("=", 1)
         value = value.strip() # trim whitespace from the start and end
-        if value[-1] == "\"" and value[0] == "\"":
+        if value and value[-1] == "\"" and value[0] == "\"":
             value = value[1:-1] # remove " from the start and end
 
         if add_cr:
             value = value.replace("\\n", "\\r\\n") # prefix $\n with $\r
             value = value.replace("\\r\\r", "\\r") # replace $\r$\r with $\r
 
         value = value.replace("\"", "$\\\"") # prefix " with $\
         value = value.replace("\\r", "$\\r") # prefix \r with $