Neo: NullReferenceException when createAccount using scriptHash

Created on 24 Jul 2019  路  5Comments  路  Source: neo-project/neo

I came across an Exception when testing CreateAccount(UInt160 scriptHash) in Neo.Wallets.SQLite.UserWallet.

CreateAccount(UInt160 scriptHash) will call AddAccount(UserWalletAccount account, bool is_import) method but line126 Address db_address = ctx.Addresses.FirstOrDefault(p => p.ScriptHash == account.Contract.ScriptHash.ToArray()); in Neo.Wallets.SQLite.UserWallet will throw a NullReferenceException because account.Contract is null.

I think we need to add a nullable check before line126 .
image

under investigation

Most helpful comment

Take a look at this pr:

https://github.com/eryeer/neoUT/pull/10

All 5 comments

Could you share with me this Unit test file?

Please take a look at TestCreateAccountByScriptHash method in this file UT_UserWallet.cs

Take a look at this pr:

https://github.com/eryeer/neoUT/pull/10

Nick work @shargon ! Now I can close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shargon picture shargon  路  3Comments

igormcoelho picture igormcoelho  路  3Comments

lock9 picture lock9  路  4Comments

igormcoelho picture igormcoelho  路  3Comments

shargon picture shargon  路  3Comments