mirror of
https://github.com/EngineerSmith/nativefs.git
synced 2025-11-08 23:15:02 +00:00
Add type check to nativefs.getDirectoryItemsInfo()
Fixes coredump caused by passing nil to argument #1 of nativefs.getDirectoryItemsInfo(). Aside: An invalid arg #2 (filtertype) can slip by if the inner function doesn't iterate over any actual directory items. Perhaps it would be better to type-check in withTempMount(), as that seems to be the source of the issue here and in getDirectoryItems().
This commit is contained in:
@@ -373,6 +373,9 @@ local function getDirectoryItemsInfo(path, filtertype)
|
||||
end
|
||||
|
||||
function nativefs.getDirectoryItemsInfo(path, filtertype)
|
||||
if type(path) ~= "string" then
|
||||
error("bad argument #1 to 'getDirectoryItemsInfo' (string expected, got " .. type(path) .. ")")
|
||||
end
|
||||
local result, err = withTempMount(path, getDirectoryItemsInfo, filtertype)
|
||||
return result or {}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user