mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-14 01:42:54 +01:00
Fix null pointer exception in Is function
Updated the Is function in senderror.go to handle null values for SendError. This was done by adding a nil-check for surfaced pointer errors in the errors.As call. This prevents the function from attempting to derive values from a null pointer and consequently prevents null pointer exceptions from being thrown.
This commit is contained in:
parent
b79374224c
commit
81306e4dd3
1 changed files with 1 additions and 1 deletions
|
@ -98,7 +98,7 @@ func (e *SendError) Error() string {
|
||||||
// Is implements the errors.Is functionality and compares the SendErrReason
|
// Is implements the errors.Is functionality and compares the SendErrReason
|
||||||
func (e *SendError) Is(et error) bool {
|
func (e *SendError) Is(et error) bool {
|
||||||
var t *SendError
|
var t *SendError
|
||||||
if errors.As(et, &t) {
|
if errors.As(et, &t) && t != nil {
|
||||||
return e.Reason == t.Reason && e.isTemp == t.isTemp
|
return e.Reason == t.Reason && e.isTemp == t.isTemp
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue