mirror of
https://github.com/EngineerSmith/nativefs.git
synced 2025-11-08 23:15:02 +00:00
Add type check to nativefs.getDirectoryItems(dir)
Most incorrect types for 'dir' are caught deeper into the call stack, but passing nil causes a coredump. This type-check mirrors the behavior of love.filesystem.getDirectoryItems().
This commit is contained in:
@@ -351,6 +351,9 @@ local function withTempMount(dir, fn, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function nativefs.getDirectoryItems(dir)
|
function nativefs.getDirectoryItems(dir)
|
||||||
|
if type(dir) ~= "string" then
|
||||||
|
error("bad argument #1 to 'getDirectoryItems' (string expected, got " .. type(dir) .. ")")
|
||||||
|
end
|
||||||
local result, err = withTempMount(dir, love.filesystem.getDirectoryItems)
|
local result, err = withTempMount(dir, love.filesystem.getDirectoryItems)
|
||||||
return result or {}
|
return result or {}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user