Avoid crash if profiles.ini is using UTF-16 LE BOM
This commit is contained in:
parent
fd27af040b
commit
7940e3a219
1 changed files with 5 additions and 1 deletions
|
|
@ -828,7 +828,11 @@ def get_firefox_default_profile(profiles_ini):
|
||||||
|
|
||||||
# Parse INI
|
# Parse INI
|
||||||
parser = configparser.ConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
|
try:
|
||||||
parser.read(profiles_ini)
|
parser.read(profiles_ini)
|
||||||
|
except (configparser.ParsingError, UnicodeError):
|
||||||
|
# Assuming we have the wrong encoding
|
||||||
|
parser.read(profiles_ini, encoding='utf-16')
|
||||||
for section in parser.sections():
|
for section in parser.sections():
|
||||||
if section.lower().startswith('install'):
|
if section.lower().startswith('install'):
|
||||||
default_profile = parser[section].get('default')
|
default_profile = parser[section].get('default')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue