Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
Fix reference error when leaderboard is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Mobius1 committed Oct 7, 2020
1 parent 6829866 commit 6f1303c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ui/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ function fillSegments(pr, child) {
}

function TriggerRankChange(rankUp, current, previous) {
leaderboard.updateRank(currentID, current)
if ( leaderboard && currentID ) {
leaderboard.updateRank(currentID, current);
}

fetch(`https://${GetParentResourceName()}/xpm_rankchange`, {
method: 'POST',
Expand Down
6 changes: 4 additions & 2 deletions ui/js/class.leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ class Leaderboard {
}

updateRank(id, rank) {
this.players[id].rank = rank;
this.players[id].row.querySelector(".xpm-leaderboard--playerranknum").textContent = rank;
if ( id in this.players ) {
this.players[id].rank = rank;
this.players[id].row.querySelector(".xpm-leaderboard--playerranknum").textContent = rank;
}
}
}

0 comments on commit 6f1303c

Please sign in to comment.