git ssb

1+

mixmix / scuttle-shell



Commit 5595aa2004958d49c90de01b2c68fc8fbd4f365c

don't crash when no info is in ssb-about

new users might not have published type:about's yet.
Henry committed on 9/13/2018, 7:39:44 PM
Parent: ec2cfa20da9cb844e2d27ddebc9686389de38874

Files changed

server.jschanged
server.jsView
@@ -151,11 +151,21 @@
151151 if (err) {
152152 console.warn('got err from about idx:', err)
153153 return
154154 }
155- const myName = curr[ssbConfig.keys.id]['name'][ssbConfig.keys.id]
156- if (myName instanceof Array && myName.length === 2) { // format is [ 'name', ts ]
157- console.log('updating menu with', myName[0])
155 + const myAbouts = curr[ssbConfig.keys.id]
156 + if (typeof myAbouts === 'undefined') {
157 + // new key maybe? might not have set a name yet
158 + return
159 + }
160 + const myNames = myAbouts['name']
161 + if (typeof myNames === 'undefined') {
162 + // new key maybe? might not have set a name yet
163 + return
164 + }
165 + const fromMe = myNames[ssbConfig.keys.id]
166 + if (fromMe instanceof Array && fromMe.length === 2) { // format is [ 'name', ts ]
167 + console.log('updating menu with', fromMe[0])
158168 tray.emit('action', {
159169 type: 'update-item',
160170 seq_id: 0,
161171 item: {

Built with git-ssb-web