Fix: Only allow leaderboard for server songs with numeric IDs

This commit is contained in:
2026-01-17 19:46:24 +08:00
parent 0706f99427
commit 3f7ff13ef7

View File

@@ -3335,7 +3335,11 @@ class SongSelect {
});
}
toLeaderboard() {
if (!this.songs[this.selectedSong].id) {
var songId = this.songs[this.selectedSong].id
// Only allow leaderboard for server songs with numeric IDs
if (!songId || typeof songId !== 'number' || isNaN(songId)) {
// Show alert for custom/local songs
alert("排行榜仅支持服务器歌曲\nLeaderboard only available for server songs")
return
}
// Default to first available difficulty if not in a valid difficulty selection
@@ -3347,6 +3351,7 @@ class SongSelect {
this.clean()
this.playSound("se_don")
new Leaderboard().display(this.songs[this.selectedSong].id, diffId)
new Leaderboard().display(songId, diffId)
}
}