Skip to content

Commit

Permalink
Add 0 protection to online counter
Browse files Browse the repository at this point in the history
  • Loading branch information
petrvecera committed Sep 26, 2023
1 parent 7f5d77e commit c64cdb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/online-players.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export const OnlinePlayers: React.FC = () => {
!onlinePlayersData
) {
const fetchData = await fetch("/api/onlineSteamPlayers");
setOnlinePlayersData(await fetchData.json());
const data = await fetchData.json();
if (data && data.playerCount > 0) {
setOnlinePlayersData(data);
}
}
} catch (e) {
console.error(e);
Expand Down

0 comments on commit c64cdb3

Please sign in to comment.