Skip to content

Commit f0ef802

Browse files
Copilotabcxff
andcommitted
Remove redundant MAX_SAFE_INTEGER checks with isFinite
Co-authored-by: abcxff <79597906+abcxff@users.noreply.github.com>
1 parent 4a56f20 commit f0ef802

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Const/Commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export const commandCallbacks = {
217217
const score = parseInt(scoreArg);
218218
const camera = client.camera?.cameraData;
219219
const player = client.camera?.cameraData.player;
220-
if (!isFinite(score) || score > Number.MAX_SAFE_INTEGER || score < Number.MIN_SAFE_INTEGER || !Entity.exists(player) || !TankBody.isTank(player) || !camera) return;
220+
if (!isFinite(score) || !Entity.exists(player) || !TankBody.isTank(player) || !camera) return;
221221
camera.score = score;
222222
},
223223
game_set_stat_max: (client: Client, statIdArg: string, statMaxArg: string) => {
@@ -242,7 +242,7 @@ export const commandCallbacks = {
242242
const points = parseInt(pointsArg);
243243
const camera = client.camera?.cameraData;
244244
const player = client.camera?.cameraData.player;
245-
if (!isFinite(points) || points > Number.MAX_SAFE_INTEGER || points < Number.MIN_SAFE_INTEGER || !Entity.exists(player) || !TankBody.isTank(player) || !camera) return;
245+
if (!isFinite(points) || !Entity.exists(player) || !TankBody.isTank(player) || !camera) return;
246246
camera.statsAvailable += points;
247247
},
248248
game_teleport: (client: Client, xArg: string, yArg: string) => {

0 commit comments

Comments
 (0)