diff --git a/Passepartout/App/Reusable/Validators.swift b/Passepartout/App/Reusable/Validators.swift index c3329cb4..c820349d 100644 --- a/Passepartout/App/Reusable/Validators.swift +++ b/Passepartout/App/Reusable/Validators.swift @@ -61,10 +61,9 @@ struct Validators { var sin = sockaddr_in() var sin6 = sockaddr_in6() - guard string.withCString({ cstring in inet_pton(AF_INET6, cstring, &sin6.sin6_addr) }) == 1 else { - throw ValidationError.ipAddress - } - if string.withCString({ cstring in inet_pton(AF_INET, cstring, &sin.sin_addr) }) == 1 { + guard string.withCString({ cstring in inet_pton(AF_INET6, cstring, &sin6.sin6_addr) }) == 1 || + string.withCString({ cstring in inet_pton(AF_INET, cstring, &sin.sin_addr) }) == 1 else { + throw ValidationError.ipAddress } }