From 41c0dd44eb53c8048c40e9ab5be5530d6330fb81 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Tue, 1 Oct 2019 09:46:49 +0100 Subject: [PATCH] fix(BitField): throw when resolving invalid string constant Checked to see if the permission actually exists. --- src/util/BitField.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/BitField.js b/src/util/BitField.js index 757da7ab9..f849e7b8a 100644 --- a/src/util/BitField.js +++ b/src/util/BitField.js @@ -146,7 +146,7 @@ class BitField { if (typeof bit === 'number' && bit >= 0) return bit; if (bit instanceof BitField) return bit.bitfield; if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0); - if (typeof bit === 'string') return this.FLAGS[bit]; + if (typeof bit === 'string' && typeof this.FLAGS[bit] !== 'undefined') return this.FLAGS[bit]; throw new RangeError('BITFIELD_INVALID'); } }