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