Commit 7b7da231 authored by Emmanuel Gil Peyrot's avatar Emmanuel Gil Peyrot

Don’t crash when the config file is malformed.

parent 3f6e0c92
......@@ -38,6 +38,9 @@ from common import caps_cache
import sqlite3 as sqlite
import logger
import logging
log = logging.getLogger('gajim.c.optparser')
class OptionsParser:
def __init__(self, filename):
self.__filename = filename
......@@ -63,7 +66,11 @@ class OptionsParser:
line = line.decode('utf-8')
except UnicodeDecodeError:
line = line.decode(locale.getpreferredencoding())
optname, key, subname, value = regex.match(line).groups()
match = regex.match(line)
if match is None:
log.warn('Invalid configuration line, ignoring it: %s', line)
continue
optname, key, subname, value = match.groups()
if key is None:
self.old_values[optname] = value
gajim.config.set(optname, value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment