Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

fix: dht.findProvs.js handle valid hash but no providers #950

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/dht/findprovs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ module.exports = (send) => {
}

const handleResult = (res, callback) => {
// 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]
Expand Down