From 61b961a116d9ea89a3018f824ac8155da967aa1a Mon Sep 17 00:00:00 2001 From: Codel1417 Date: Thu, 5 Dec 2024 20:06:22 -0500 Subject: [PATCH] resolve casual mode exception --- lib/Backend/sensors.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Backend/sensors.dart b/lib/Backend/sensors.dart index 18de4707..163ff11a 100644 --- a/lib/Backend/sensors.dart +++ b/lib/Backend/sensors.dart @@ -550,7 +550,7 @@ class RandomTriggerDefinition extends TriggerDefinition { int max = HiveProxy.getOrDefault(settings, casualModeDelayMax, defaultValue: casualModeDelayMaxDefault); await Future.delayed(Duration(seconds: min)); if (enabled) { - randomTimer = Timer(Duration(seconds: Random().nextInt(max - min)), () { + randomTimer = Timer(Duration(seconds: Random().nextInt((max - min).clamp(1, max))), () { sendCommands("Action", ref); onEnable(); });