only check min < val < max if min and max are defined

This commit is contained in:
Shish 2015-10-19 07:19:53 +01:00
parent 0855c7e9c4
commit f8cb2e96e4

View file

@ -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;
}