mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-24 15:50:01 +00:00
Use pcall() on Promise.is when looking for the .andThen function
Some tables might have strict metatables that error if a non-existant member is indexed, causing the chain to fail.
This commit is contained in:
parent
17becff40b
commit
4586cc5a90
1 changed files with 5 additions and 1 deletions
|
@ -471,7 +471,11 @@ function Promise.is(object)
|
|||
return false
|
||||
end
|
||||
|
||||
return type(object.andThen) == "function"
|
||||
local ok, isPromise = pcall(function()
|
||||
return type(object.andThen) == "function"
|
||||
end)
|
||||
|
||||
return ok and isPromise
|
||||
end
|
||||
|
||||
--[[
|
||||
|
|
Loading…
Reference in a new issue