Skip to content

Commit

Permalink
lime-system: warn non existent default opt access
Browse files Browse the repository at this point in the history
Previous commit made evident that parts of the code where accessing non
existent configuations with undeclared default, print a warning and
stacktrace if it happens and avoid screwing configuration type
  • Loading branch information
G10h4ck committed May 26, 2017
1 parent 694a0ab commit 8e01004
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/lime-system/files/usr/lib/lua/lime/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ function config.get(sectionname, option, default)
if limeconf then return limeconf end

local defcnf = config.uci:get("lime-defaults", sectionname, option, default)
config.set(sectionname, option, defcnf)
if ( defcnf ~= nil ) then
config.set(sectionname, option, defcnf)
else
local cfn = sectionname.."."..option
print("WARNING: Attempt to access undeclared default for: "..cfn)
print(debug.traceback())
end
return defcnf
end

Expand Down

0 comments on commit 8e01004

Please sign in to comment.