Skip to content

Commit

Permalink
Nil pointer protection
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyilong committed Apr 29, 2020
1 parent 69a5b7b commit 99e725d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion p2p/peer/peer_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,7 @@ func (pt *PeerTable) persistPeers() {
}

func (pt *PeerTable) writeToDB(key, value string) {
pt.db.Put([]byte(key), []byte(value), nil)
if pt.db != nil {
pt.db.Put([]byte(key), []byte(value), nil)
}
}

0 comments on commit 99e725d

Please sign in to comment.