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

Possible NullReference Exception #53

Open
tmacharia opened this issue May 24, 2021 · 2 comments
Open

Possible NullReference Exception #53

tmacharia opened this issue May 24, 2021 · 2 comments

Comments

@tmacharia
Copy link

if (phoneNumber.Length == 0 || shortCode.Length == 0 || keyWord.Length == 0 || !IsPhoneNumber(numbers))

Hi, this check will fail when a string in null since you can't call .Length on a null string object.

I would suggest using String.IsNullOrWhiteSpace(String) to do the check.

You can create a test case wherein you pass null for phoneNumber/shortCode/keyWord and see that a NullObjectReferenceException is thrown instead of the anticipated AfricasTalkingGatewayException

@TheBeachMaster
Copy link
Collaborator

Nice catch, would you mind sending a PR with a minor version bump...

@tmacharia
Copy link
Author

Let me see.

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

No branches or pull requests

2 participants