scripts: common-utils: do not crash if the defaults table is nil
Fixes #542, #544
This commit is contained in:
@@ -168,14 +168,16 @@ function cutils.get_config_section (name, defaults)
|
|||||||
section = defaults or {}
|
section = defaults or {}
|
||||||
else
|
else
|
||||||
section = section:parse ()
|
section = section:parse ()
|
||||||
for k, v in pairs (defaults) do
|
if defaults then
|
||||||
if section [k] == nil then
|
for k, v in pairs (defaults) do
|
||||||
section [k] = v
|
if section [k] == nil then
|
||||||
|
section [k] = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
for k, v in ipairs (defaults) do
|
||||||
for k, v in ipairs (defaults) do
|
if section [k] == nil then
|
||||||
if section [k] == nil then
|
section [k] = v
|
||||||
section [k] = v
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user