Issue Type: Other
Impact: Low
Frequency: Very Rare
Date First Experienced: 2021-04-14 16:45:00 (-03:00)
Date Last Experienced:
Reproduction Steps:
- Open an empty baseplate
- Create a script with the following code and run it (or alternatively run the following code in the command bar)
-- No errors are thrown in the following lines
game.CollectionService:AddTag(nil, "Hello")
print(game.CollectionService:HasTag(nil, "Hello")) -- > false
game.CollectionService:RemoveTag(nil, "Hello")
- Open the output. No errors have been thrown, and
false
from the third line is printed.
Expected Behavior:
Since it’s invalid to assign a tag to nil, I expected the functions to error. I came across this bug while debugging my own code, when I realized that I was mistakenly passing a typo-ed variable (which didn’t exist, so it resolved to nil) to CollectionService:AddTag()
when I intended to pass a valid instance value instead. Note that if this is fixed, there is a chance that scripts which did not error before will no longer work. Passing other value types such as numbers and booleans return errors as normal.
Actual Behavior:
CollectionService tag-related APIs such as HasTag
, AddTag
and RemoveTag
do not throw errors and silently fail when an invalid instance reference, nil, is given. This was tested on Studio Version 0.473.0.420291 (64bit) and in game and it happens in both.
Workaround: