git ssb

10+

Matt McKegg / patchwork



Commit d4131d5fd9230e7811031665045b96e6b8c6eb1d

sbot: fix roots when used against empty feed

Matt McKegg committed on 9/29/2017, 6:55:59 AM
Parent: fa872384db2701c4af5615677115890b31d29e78

Files changed

sbot/roots.jschanged
sbot/roots.jsView
@@ -205,13 +205,15 @@
205205 }
206206
207207 function checkFollowing (lookup, ids, target) {
208208 // 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)
210211 return value && value[0]
211212 }
212213
213214 function checkChannel (lookup, ids, channel) {
215+ if (!lookup) return false
214216 channel = normalizeChannel(channel)
215217 if (channel) {
216218 var value = mostRecentValue(ids.map(id => lookup[`${id}:${channel}`]))
217219 return value && value[1]

Built with git-ssb-web