Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException when createAccount using scriptHash #951

Closed
eryeer opened this issue Jul 24, 2019 · 5 comments · Fixed by #1018
Closed

NullReferenceException when createAccount using scriptHash #951

eryeer opened this issue Jul 24, 2019 · 5 comments · Fixed by #1018
Labels
Under Investigation The problem mentioned, or possible improvement, is under investigation

Comments

@eryeer
Copy link
Contributor

eryeer commented Jul 24, 2019

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

@shargon
Copy link
Member

shargon commented Jul 24, 2019

Could you share with me this Unit test file?

@lock9 lock9 added the Under Investigation The problem mentioned, or possible improvement, is under investigation label Jul 24, 2019
@eryeer
Copy link
Contributor Author

eryeer commented Jul 25, 2019

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

@shargon
Copy link
Member

shargon commented Jul 25, 2019

Take a look at this pr:

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

@eryeer
Copy link
Contributor Author

eryeer commented Jul 25, 2019

Nick work @shargon ! Now I can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Under Investigation The problem mentioned, or possible improvement, is under investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants