From d75f7d55cf191e9c599470034ea3f27745d75693 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sun, 9 Jan 2011 15:12:42 +0100 Subject: [PATCH] PascalScript: Fix Wait() with negative values. --- Units/MMLAddon/PSInc/Wrappers/other.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Units/MMLAddon/PSInc/Wrappers/other.inc b/Units/MMLAddon/PSInc/Wrappers/other.inc index e0b4f54..c793ecc 100644 --- a/Units/MMLAddon/PSInc/Wrappers/other.inc +++ b/Units/MMLAddon/PSInc/Wrappers/other.inc @@ -40,12 +40,18 @@ end; procedure ps_Wait(t: Integer); extdecl; {$ifdef MSWINDOWS} begin - Sleep(t); + if t < 0 then + raise Exception.CreateFmt('The given wait time ([%d]) is invalid.',[t]) + else + Sleep(t); end; {$else} var EndTime : DWord; begin + if t < 0 then + raise Exception.CreateFmt('The given wait time ([%d]) is invalid.',[t]); + if t > 50 then begin; EndTime := GetTickCount + t;