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

Decode null string thows NullReferenceException #93

Open
ellull opened this issue Oct 25, 2023 · 1 comment · May be fixed by #94
Open

Decode null string thows NullReferenceException #93

ellull opened this issue Oct 25, 2023 · 1 comment · May be fixed by #94

Comments

@ellull
Copy link

ellull commented Oct 25, 2023

We were using the 1.4.1 version of this library and decoding a null string returned an empty array. But after upgrading to the 1.7.0 version it throws a NullReferenceException.

With git bisect I found that the bug was introduced in the commit 480cabe.

The bug is in the long[] Hashids.GetNumbersFrom(string hash) method. If hash is null, the variable result will be an empty array, which is expected but in the next line of GetNumbersFrom it uses the Length property of hash, which is null and the NullReferenceException is thrown.

After creating the issue I'll create a PR with the unit tests and the fix.

@ellull ellull linked a pull request Oct 25, 2023 that will close this issue
@ullmark
Copy link
Owner

ullmark commented Oct 26, 2023

Nice, thank you @ellull I'll look at your PR and see if I can get a new version out shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants