Fail gracefully when list is assigned to string field

This commit is contained in:
starkos 2009-02-05 15:58:38 +00:00
parent 7124c4d80d
commit afc9783ec0
2 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,7 @@
- Bug 2564404: FatalWarnings has no effect with gmake target
- Support links and libdirs for Visual Studio static libraries
- Fail gracefully when list is assigned to string field
-----

View File

@ -457,11 +457,17 @@
-- The getter/setter implemention.
--
local function accessor(name, value)
local function accessor(name, value)
local kind = premake.fields[name].kind
local scope = premake.fields[name].scope
local allowed = premake.fields[name].allowed
if (kind == "string" or kind == "path" and value) then
if type(value) ~= "string" then
error("string value expected", 3)
end
end
if (kind == "string") then
return premake.setstring(scope, name, value, allowed)
elseif (kind == "path") then