Open tmacharia opened 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.
null
.Length
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
NullObjectReferenceException
AfricasTalkingGatewayException
Nice catch, would you mind sending a PR with a minor version bump...
Let me see.
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 anticipatedAfricasTalkingGatewayException