Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions walletapi/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ func (w *Wallet_Memory) TokenAdd(scid crypto.Hash) (err error) {
w.Lock()
defer w.Unlock()

// Guard against a nil map on a freshly created/restored, not-yet-synced
// wallet (EntriesNative is populated lazily during sync). Without this the
// assignment below panics with "assignment to entry in nil map". Mirrors the
// guard already present in InsertReplace.
if w.account.EntriesNative == nil {
w.account.EntriesNative = map[crypto.Hash][]rpc.Entry{}
}

if _, ok := w.account.EntriesNative[scid]; !ok {
w.account.EntriesNative[scid] = []rpc.Entry{}
} else {
Expand Down