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

Commit

Permalink
fix: dht.findProvs.js handle valid hash but no providers (#950)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Nitin Patel <nitinpatel278@gmail.com>
  • Loading branch information
niinpatel authored and Alan Shaw committed Mar 15, 2019
1 parent 0c109ab commit c3cde76
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit c3cde76

Please sign in to comment.