AfricasTalkingLtd / africastalking.Net

Africa's Talking API Wrapper for C#
https://developers.africastalking.com
MIT License
18 stars 38 forks source link

Possible NullReference Exception #53

Open tmacharia opened 3 years ago

tmacharia commented 3 years ago

https://github.com/AfricasTalkingLtd/africastalking.Net/blob/640b1955ffbe7f28da0a14fd1adfdab08813bad7/AfricasTalkingCS/AfricasTalkingGateway.cs#L398

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 commented 3 years ago

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

tmacharia commented 3 years ago

Let me see.