channeldb: add some missing nil checks

This commit is contained in:
Olaoluwa Osuntokun committed 2016-09-12 19:06:57 -07:00
1 parent e83a6a0f6c
commit 2235785ed8
1 file changed
+7
+7
View File
@@ -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 {