mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
channeldb: add some missing nil checks
This commit is contained in:
parent
e83a6a0f6c
commit
2235785ed8
1 changed files with 7 additions and 0 deletions
|
@ -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
|
// item in the inner chan ID bucket. This bucket acts as an
|
||||||
// index for all channels we currently have open with this node.
|
// index for all channels we currently have open with this node.
|
||||||
nodeChanIDBucket := nodeChanBucket.Bucket(chanIDBucket[:])
|
nodeChanIDBucket := nodeChanBucket.Bucket(chanIDBucket[:])
|
||||||
|
if nodeChanIDBucket == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
err := nodeChanIDBucket.ForEach(func(k, v []byte) error {
|
err := nodeChanIDBucket.ForEach(func(k, v []byte) error {
|
||||||
|
if k == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
outBytes := bytes.NewReader(k)
|
outBytes := bytes.NewReader(k)
|
||||||
chanID := &wire.OutPoint{}
|
chanID := &wire.OutPoint{}
|
||||||
if err := readOutpoint(outBytes, chanID); err != nil {
|
if err := readOutpoint(outBytes, chanID); err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue