Skip to content

Commit

Permalink
Fix sleep bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Jan 25, 2024
1 parent 5f93bf1 commit 310bf8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Fixes to bugs found via fuzzing
* Fixed improper parsing of numbers with too many decimal points.
* Fixed exponential running time when raising a decimal number to a very large power (> 1 million) -- it now returns an overflow error.
* Shared values that contain reference loops no longer cause a stack overflow when printing.
* `sleep` no longer panics on `NaN`.

Other bug fixes
---------------
Expand Down
2 changes: 1 addition & 1 deletion src/packages/lang_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ mod core_functions {
#[cfg(not(feature = "no_std"))]
#[rhai_fn(name = "sleep", volatile)]
pub fn sleep_float(seconds: FLOAT) {
if seconds <= 0.0 {
if !seconds.is_normal() || seconds.is_sign_negative() {
return;
}

Expand Down

0 comments on commit 310bf8a

Please sign in to comment.