mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 12:01:38 +00:00
Handle falsy API values
This commit is contained in:
parent
9cf195691c
commit
d83543e3cc
1 changed files with 8 additions and 2 deletions
|
|
@ -201,10 +201,10 @@ function API.new(app)
|
|||
-- Sanitize request
|
||||
local sanitizedApis = {}
|
||||
for _, api in apis do
|
||||
if Rojo[api] then
|
||||
if Rojo[api] ~= nil then
|
||||
table.insert(sanitizedApis, api)
|
||||
else
|
||||
warn(string.format("Rojo.%s is not a valid API", api))
|
||||
warn(string.format("Rojo.%s is not a valid API", tostring(api)))
|
||||
end
|
||||
end
|
||||
assert(#sanitizedApis > 0, "Rojo:RequestAccess expects an array of valid API names")
|
||||
|
|
@ -329,6 +329,12 @@ function API.new(app)
|
|||
return nil
|
||||
end
|
||||
|
||||
-- Existence check
|
||||
if Rojo[key] == nil then
|
||||
warn(string.format("Rojo.%s is not a valid API", tostring(key)))
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Permissions check
|
||||
local granted = Rojo:_permissionCheck(key)
|
||||
if not granted then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue