Providing the LocalPlayer:GetFriendsOnline({num}) method with a negative integer results in an unexpected crash

Description:
If the LocalPlayer:GetFriendsOnline({num}) method is provided a negative integer, it’ll trigger an unexpected crash.

Lua:

game:GetService("Players").LocalPlayer:GetFriendsOnline(-1)

Result:

Solution:
Implement proper error handling, validate the integer is above 0 and less than 201.

Impact:
Annoying bug, crashes the client. If you accidentally provide a negative integer, it’ll crash your players in production.

It’s also possible to upload a plugin containing the above Lua, which will result in an unexpected crash until the user uninstalls the plugin.

Result:

Place: test - Roblox

4 Likes

Just a heads up, the repo place that you provided is private.

1 Like

My bad, it’s public now. Thank you.

1 Like

Between when the bug was initially reported and now, the behaviour has changed. Providing the method with a negative integer or an integer above 200 does not crash the client.

image

Thanks!

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