From 2bbbbb97369cc4848ff8d9236d73875f9c85ee51 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 14 Mar 2024 14:43:56 +0000 Subject: [PATCH] Force `runIntervalSeconds` to never fall below 1 to stop peope breaking their server by editing config values blindly --- project/src/callbacks/InsuranceCallbacks.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project/src/callbacks/InsuranceCallbacks.ts b/project/src/callbacks/InsuranceCallbacks.ts index 1af24868..59e6a443 100644 --- a/project/src/callbacks/InsuranceCallbacks.ts +++ b/project/src/callbacks/InsuranceCallbacks.ts @@ -52,7 +52,8 @@ export class InsuranceCallbacks implements OnUpdate public async onUpdate(secondsSinceLastRun: number): Promise { - if (secondsSinceLastRun > this.insuranceConfig.runIntervalSeconds) + // People edit the config value to be 0 and break it, force value to no lower than 1 + if (secondsSinceLastRun > Math.max(this.insuranceConfig.runIntervalSeconds, 1)) { this.insuranceController.processReturn(); return true;