diff --git a/src/dht/findprovs.js b/src/dht/findprovs.js index dd2d82f58..acfd1329f 100644 --- a/src/dht/findprovs.js +++ b/src/dht/findprovs.js @@ -23,17 +23,17 @@ module.exports = (send) => { } const handleResult = (res, callback) => { + // Inconsistent return values in the browser vs node + if (Array.isArray(res)) { + res = res[0] + } + // callback with an empty array if no providers are found if (!res) { const responses = [] return callback(null, responses) } - // Inconsistent return values in the browser vs node - if (Array.isArray(res)) { - res = res[0] - } - // Type 4 keys if (res.Type !== 4) { const errMsg = `key was not found (type 4)`