-
Notifications
You must be signed in to change notification settings - Fork 100
Add nil checks for team properties #6959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add checks for nil values in team streak and rating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds nil checks for team streak and rating properties to prevent a runtime error on the Liquipedia Rating portal page. The error was occurring when attempting to compare nil values with numbers.
- Adds nil validation before processing team data in the ratings list display
- Skips teams with missing streak or rating values to allow the page to render
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (team.streak == nil) or (team.rating == nil) then | ||
| return | ||
| end |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping teams with nil streak or rating values will cause the rank numbers to be incorrect. The rank is passed from Array.forEach which counts all teams including skipped ones. Consider filtering teams before the forEach loop to maintain accurate rankings, or adjust the rank counter when teams are skipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nếu
| :allDone() | ||
|
|
||
| Array.forEach(teams, function(team, rank) | ||
| if (team.streak == nil) or (team.rating == nil) then |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parentheses around the nil checks are unnecessary in Lua. The condition can be simplified to: if team.streak == nil or team.rating == nil then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better would be to filter before the forEach loop
local validTeams = Array.filter(teams, function(team)
return team.streak ~= nil and team.rating ~= nil
end)
Array.forEach(validTeams, function(team, rank)
.....
Add checks for nil values in team streak and rating.
Summary
There is currently an error on the Liquipedia Rating portal page (https://liquipedia.net/rocketleague/Portal:Rating) that prevents the rating list being created:
Module:Ratings/Display/List:70: attempt to compare number with nil (stack trace logged)The following change allows the rating list to work as usual on the portal page by discarding teams which return nil values in their streak or rating.
How did you test this change?
Tested the changes using
|dev=umron my userspace (https://liquipedia.net/rocketleague/User:Umr_1000/draft). The rating list is generated with the given change without any issues.