scripts: common-utils: do not crash if the defaults table is nil

Fixes #542, #544
This commit is contained in:
George Kiagiadakis
2023-12-18 10:56:30 +02:00
parent b58c94816a
commit c0b212bb0e

View File

@@ -168,6 +168,7 @@ function cutils.get_config_section (name, defaults)
section = defaults or {}
else
section = section:parse ()
if defaults then
for k, v in pairs (defaults) do
if section [k] == nil then
section [k] = v
@@ -179,6 +180,7 @@ function cutils.get_config_section (name, defaults)
end
end
end
end
return section
end