Commit d4131d5fd9230e7811031665045b96e6b8c6eb1d
sbot: fix roots when used against empty feed
Matt McKegg committed on 9/29/2017, 6:55:59 AMParent: fa872384db2701c4af5615677115890b31d29e78
Files changed
sbot/roots.js | changed |
sbot/roots.js | ||
---|---|---|
@@ -205,13 +205,15 @@ | ||
205 | 205 | } |
206 | 206 | |
207 | 207 | function checkFollowing (lookup, ids, target) { |
208 | 208 | // TODO: rewrite contacts index (for some reason the order is different) |
209 | - var value = mostRecentValue(ids.map(id => lookup[id].following && lookup[id].following[target]), 1) | |
209 | + if (!lookup) return false | |
210 | + var value = mostRecentValue(ids.map(id => lookup[id] && lookup[id].following && lookup[id].following[target]), 1) | |
210 | 211 | return value && value[0] |
211 | 212 | } |
212 | 213 | |
213 | 214 | function checkChannel (lookup, ids, channel) { |
215 | + if (!lookup) return false | |
214 | 216 | channel = normalizeChannel(channel) |
215 | 217 | if (channel) { |
216 | 218 | var value = mostRecentValue(ids.map(id => lookup[`${id}:${channel}`])) |
217 | 219 | return value && value[1] |
Built with git-ssb-web