Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

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
Contributor

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants