Check argument against negative sleep duration
This commit is contained in:
@@ -36,7 +36,7 @@ impl lb_tasklib {
|
||||
}
|
||||
|
||||
pub async extern "Lua-C" fn sleep(ms: f64) {
|
||||
sleep(Duration::from_secs_f64(ms / 1000.)).await;
|
||||
sleep(Duration::from_secs_f64(ms.max(0.) / 1000.)).await;
|
||||
}
|
||||
|
||||
pub extern "Lua" fn spawn(f: function, ...) -> lb_task {
|
||||
|
||||
Reference in New Issue
Block a user