mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 20:21: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
|
-- Sanitize request
|
||||||
local sanitizedApis = {}
|
local sanitizedApis = {}
|
||||||
for _, api in apis do
|
for _, api in apis do
|
||||||
if Rojo[api] then
|
if Rojo[api] ~= nil then
|
||||||
table.insert(sanitizedApis, api)
|
table.insert(sanitizedApis, api)
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
assert(#sanitizedApis > 0, "Rojo:RequestAccess expects an array of valid API names")
|
assert(#sanitizedApis > 0, "Rojo:RequestAccess expects an array of valid API names")
|
||||||
|
|
@ -329,6 +329,12 @@ function API.new(app)
|
||||||
return nil
|
return nil
|
||||||
end
|
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
|
-- Permissions check
|
||||||
local granted = Rojo:_permissionCheck(key)
|
local granted = Rojo:_permissionCheck(key)
|
||||||
if not granted then
|
if not granted then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue