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:
Winni Neessen 2023-11-29 17:20:09 +01:00
parent b79374224c
commit 81306e4dd3
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

View file

@ -98,7 +98,7 @@ func (e *SendError) Error() string {
// Is implements the errors.Is functionality and compares the SendErrReason
func (e *SendError) Is(et error) bool {
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 false