Skip to content

Commit

Permalink
Merge pull request #104 from Lukasdotcom/unknown-player
Browse files Browse the repository at this point in the history
Fixes error when request for not exist player
  • Loading branch information
Lukasdotcom authored Aug 12, 2022
2 parents 5554e33 + e29c510 commit 7125975
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pages/api/player/[uid].js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ export default async function handler(req, res) {
);
}
// Tells the user if the updates are still running
result[0].updateRunning = await connection
.query("SELECT value2 FROM data WHERE value1='lastUpdateCheck'")
.then((result) =>
result.length > 0 ? Date.now() / 1000 - 600 < result[0].value2 : false
);
if (result.length > 0) {
result[0].updateRunning = await connection
.query("SELECT value2 FROM data WHERE value1='lastUpdateCheck'")
.then((result) =>
result.length > 0 ? Date.now() / 1000 - 600 < result[0].value2 : false
);
}
// Checks if the player exists
if (result.length > 0) {
res.status(200).json(result[0]);
Expand Down

0 comments on commit 7125975

Please sign in to comment.