handle NaN or undefined values in approveResources

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-05-18 14:58:44 +00:00
parent 754e7a018b
commit 4444416175

View File

@ -21,6 +21,9 @@ export async function approveResources(req, username, request) {
if (!(key in avail)) {
approved = false;
}
else if (isNaN(avail[key]) || isNaN(request[key])) {
approved = false;
}
else if (avail[key] - request[key] < 0) {
approved = false;
}