Fix crash in res.send()

In commit c6fa25985b, "var" usage
was replaced with const. The code previously worked because "var"
has function scoping unlike const which has block scoping.

TypeError: Cannot read property 'attributes' of null
This commit is contained in:
Girish Ramakrishnan 2020-12-02 14:44:31 -08:00
parent da358a814c
commit 217b984839
1 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ SearchResponse.prototype.send = function (entry, nofiltering) {
const self = this
const savedAttrs = {}
const save = null
let save = null
if (entry instanceof SearchEntry || entry instanceof SearchReference) {
if (!entry.messageID) { entry.messageID = this.messageID }
if (entry.messageID !== this.messageID) { throw new Error('SearchEntry messageID mismatch') }
@ -66,7 +66,7 @@ SearchResponse.prototype.send = function (entry, nofiltering) {
}
})
const save = entry
save = entry
entry = new SearchEntry({
objectName: typeof (save.dn) === 'string' ? parseDN(save.dn) : save.dn,
messageID: self.messageID,