From c5a0c534acb48bb01d443337b91c33e9fbc0821c Mon Sep 17 00:00:00 2001 From: Luca Moser Date: Thu, 19 Sep 2019 21:28:38 +0200 Subject: [PATCH] updates mongodb driver for account store (#125) --- account/store/mongo/mongo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account/store/mongo/mongo.go b/account/store/mongo/mongo.go index bf30a460e..117edec3d 100644 --- a/account/store/mongo/mongo.go +++ b/account/store/mongo/mongo.go @@ -138,9 +138,6 @@ func (ms *MongoStore) LoadAccount(id string) (*store.AccountState, error) { state := newaccountstate() cursor := ms.coll.FindOne(ms.cnf.ContextProvider(), bson.D{{"_id", id}}) if err := cursor.Err(); err != nil { - return nil, err - } - if err := cursor.Decode(state); err != nil { // return an empty account state object if there isn't // a previously stored account if err == mongo.ErrNoDocuments { @@ -154,6 +151,9 @@ func (ms *MongoStore) LoadAccount(id string) (*store.AccountState, error) { } return nil, err } + if err := cursor.Decode(state); err != nil { + return nil, err + } return state.AccountState(), nil }