channeldb: add some missing nil checks

This commit is contained in:
Olaoluwa Osuntokun 2016-09-06 18:48:40 -07:00
parent e83a6a0f6c
commit 2235785ed8
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -155,7 +155,14 @@ func (d *DB) FetchOpenChannels(nodeID *wire.ShaHash) ([]*OpenChannel, error) {
// item in the inner chan ID bucket. This bucket acts as an
// index for all channels we currently have open with this node.
nodeChanIDBucket := nodeChanBucket.Bucket(chanIDBucket[:])
if nodeChanIDBucket == nil {
return nil
}
err := nodeChanIDBucket.ForEach(func(k, v []byte) error {
if k == nil {
return nil
}
outBytes := bytes.NewReader(k)
chanID := &wire.OutPoint{}
if err := readOutpoint(outBytes, chanID); err != nil {