handle NaN or undefined values in approveResources
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
70953f3194
commit
505ea28e8a
5
utils.js
5
utils.js
@ -21,9 +21,12 @@ export async function approveResources(req, username, request) {
|
|||||||
if (!(key in avail)) {
|
if (!(key in avail)) {
|
||||||
approved = false;
|
approved = false;
|
||||||
}
|
}
|
||||||
else if (avail[key] - request[key] < 0) {
|
else if (isNaN(avail[key]) || isNaN(request[key])) {
|
||||||
approved = false;
|
approved = false;
|
||||||
}
|
}
|
||||||
|
else if (avail[key] - request[key] < 0) {
|
||||||
|
approved = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return approved;
|
return approved;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user