only check min < val < max if min and max are defined
This commit is contained in:
parent
0855c7e9c4
commit
f8cb2e96e4
1 changed files with 3 additions and 1 deletions
|
@ -137,7 +137,9 @@ function clamp($val, $min, $max) {
|
|||
if(!is_null($max) && $val > $max) {
|
||||
$val = $max;
|
||||
}
|
||||
assert('$val >= $min && $val <= $max', "$min <= $val <= $max");
|
||||
if(!is_null($min) && !is_null($max)) {
|
||||
assert('$val >= $min && $val <= $max', "$min <= $val <= $max");
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue