Handle nil pointer in IsTemp method in senderror.go

Added a nil check in the IsTemp method in senderror.go to prevent runtime errors when method is called on a nil object. The method now immediately returns false if it is invoked on a nil *SendError, ensuring the program's robustness against potential misuse. This increases the robustness and readability of the
This commit is contained in:
Winni Neessen 2023-11-20 18:45:35 +01:00
parent 468e1e2b2c
commit cf678be9dd
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

View file

@ -106,6 +106,9 @@ func (e *SendError) Is(et error) bool {
// IsTemp returns true if the delivery error is of temporary nature and can be retried // IsTemp returns true if the delivery error is of temporary nature and can be retried
func (e *SendError) IsTemp() bool { func (e *SendError) IsTemp() bool {
if e == nil {
return false
}
return e.isTemp return e.isTemp
} }