From ec2a9cbdd80ee91f0235cd7b354163ef915711c5 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Wed, 20 Sep 2017 14:22:33 -0400 Subject: [PATCH] Don't mismatch securities because of pointers This bug could cause transactions from imports with multiple securities to end up pointing to the wrong securities. --- imports.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imports.go b/imports.go index 669e73d..f8374ba 100644 --- a/imports.go +++ b/imports.go @@ -69,7 +69,7 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i // Find matching existing securities or create new ones for those // referenced by the OFX import. Also create a map from placeholder import // SecurityIds to the actual SecurityIDs - var securitymap = make(map[int64]*Security) + var securitymap = make(map[int64]Security) for _, ofxsecurity := range itl.Securities { // save off since ImportGetCreateSecurity overwrites SecurityId on // ofxsecurity @@ -81,7 +81,7 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i log.Print(err) return } - securitymap[oldsecurityid] = security + securitymap[oldsecurityid] = *security } if account.SecurityId != securitymap[importedAccount.SecurityId].SecurityId {