We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53f7bd1 commit 38a6e18Copy full SHA for 38a6e18
email.go
@@ -22,13 +22,17 @@ func (e Email) MarshalJSON() ([]byte, error) {
22
}
23
24
func (e *Email) UnmarshalJSON(data []byte) error {
25
+ if e == nil {
26
+ return nil
27
+ }
28
+
29
var s string
30
if err := json.Unmarshal(data, &s); err != nil {
31
return err
32
33
34
*e = Email(s)
- if e != nil && !emailRegex.MatchString(s) {
35
+ if !emailRegex.MatchString(s) {
36
return ErrValidationEmail
37
38
0 commit comments