simple_config: handle unexpected non-dict in recursive get/set_key methods
This commit is contained in:
@@ -295,7 +295,7 @@ class SimpleConfig(Logger):
|
|||||||
d = self.user_config
|
d = self.user_config
|
||||||
for x in keypath[0:-1]:
|
for x in keypath[0:-1]:
|
||||||
d2 = d.get(x)
|
d2 = d.get(x)
|
||||||
if d2 is None:
|
if not isinstance(d2, dict):
|
||||||
d2 = d[x] = {}
|
d2 = d[x] = {}
|
||||||
d = d2
|
d = d2
|
||||||
d[keypath[-1]] = value
|
d[keypath[-1]] = value
|
||||||
@@ -328,6 +328,8 @@ class SimpleConfig(Logger):
|
|||||||
path = key.split('.')
|
path = key.split('.')
|
||||||
for key in path[0:-1]:
|
for key in path[0:-1]:
|
||||||
d = d.get(key, {})
|
d = d.get(key, {})
|
||||||
|
if not isinstance(d, dict):
|
||||||
|
d = {}
|
||||||
out = d.get(path[-1], default)
|
out = d.get(path[-1], default)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user