Skip to content

Commit

Permalink
accounter: fix null pointer dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
xiphon committed Feb 19, 2020
1 parent 9a7cff7 commit 8ba3313
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion accounter/accounter.go
Expand Up @@ -191,7 +191,10 @@ func (this *Accounter) GetCumulativeDifficultyAndTimestamp(index uint32) (*big.I

func (this *Accounter) getAccountUnsafe(number uint32) *Account {
offset := number % defaults.AccountsPerBlock
return this.getPackContainingAccountUnsafe(number).GetAccount(int(offset))
if pack := this.getPackContainingAccountUnsafe(number); pack != nil {
return pack.GetAccount(int(offset))
}
return nil
}

func (this *Accounter) GetAccount(number uint32) *Account {
Expand Down

0 comments on commit 8ba3313

Please sign in to comment.