From 651a27b558456bed1c06b8fbee17988026bf5371 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Tue, 23 Feb 2016 17:16:13 +0100 Subject: [PATCH] resource set: limit.available cannot be > limit.total. --- src/xo-mixins/resource-sets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xo-mixins/resource-sets.js b/src/xo-mixins/resource-sets.js index abcf1f0ee..224318c43 100644 --- a/src/xo-mixins/resource-sets.js +++ b/src/xo-mixins/resource-sets.js @@ -234,8 +234,8 @@ export default class { return } - if ((limit.available += quantity) > limits.total) { - throw new Error(`cannot release ${quantity} ${id} in the set ${setId}`) + if ((limit.available += quantity) > limit.total) { + limit.available = limit.total } }) await this._save(set)