Skip to content

Commit

Permalink
BUG: Add back null check in parseAndValidateNum()
Browse files Browse the repository at this point in the history
This fixes the issue with negative numbers in #521.
  • Loading branch information
fedarko committed May 20, 2022
1 parent 89ea338 commit 70668f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion empress/support_files/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ define(["underscore", "toastr"], function (_, toastr) {
function parseAndValidateNum(inputEle, min = 0) {
if (isValidNumber(inputEle.value)) {
var pfVal = parseFloat(inputEle.value);
if (pfVal >= min) {
// if min is null, then the number in the input element doesn't
// have a defined lower limit -- so, for example, negative numbers
// will be accepted. This is the case when, for example, we want
// to allow users to set continuous colormaps that range from
// [-5, 5] or something.
if (_.isNull(min) || pfVal >= min) {
return pfVal;
}
}
Expand Down

0 comments on commit 70668f2

Please sign in to comment.