diff --git a/lib/controls/password-policy-control.js b/lib/controls/password-policy-control.js index b10a083..de1b55a 100644 --- a/lib/controls/password-policy-control.js +++ b/lib/controls/password-policy-control.js @@ -44,6 +44,10 @@ class PasswordPolicyControl extends Control { return } + if (options.value === null) { + return + } + if (Buffer.isBuffer(options.value)) { this.#parse(options.value) } else if (isObject(options.value)) { diff --git a/lib/controls/password-policy-control.test.js b/lib/controls/password-policy-control.test.js index a55ccfa..000c6be 100644 --- a/lib/controls/password-policy-control.test.js +++ b/lib/controls/password-policy-control.test.js @@ -50,6 +50,12 @@ tap.test('contructor', t => { t.throws(() => new PPC({ value: { timeBeforeExpiration: 1, graceAuthNsRemaining: 2 } })) }) + // null value should not fail #956 + t.test('no value shall not fail', async t => { + const control = new PPC({ value: null }) + t.same(control.value, {}) + }) + t.end() })