SortedMap:GetSizeAsync() errors with Unkown Error when sorted map is empty

Pretty much just the title, getting the size of a sorted map with no entries (like new sorted maps) will throw an unkown error instead of returning 0.

I know that it’s an async call and thus is usually wrapped in a pcall, but if there is specific behavior intended when the sorted map is empty it isn’t possible to differentiate between size 0 and an actual error without using up more rate units which can cause even more errors if it maxes out because of the additional requests.

An alternative would just be to use GetRangeAsync() with the count as 1 and no upper or lower limits (and checking if that table is empty instead), but that would only be useful to check specifically if the size is 0 and an additional request would still be needed to determine the size after verifying that it isn’t empty (when it should just be 1 request).

Expected behavior

Getting the size of a sorted map that is empty should return 0

Hi, do you still experience this problem? I did a quick test just now, and GetSizeAsync() returns zero for me for an new sorted map, as expected.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.