diff --git a/pywait.py b/pywait.py index c5c67c2..5cd02ad 100644 --- a/pywait.py +++ b/pywait.py @@ -26,9 +26,10 @@ def valid_connection_spec(connection_spec): if spec_parts[0] not in valid_protocol_specs: raise ValueError('Invalid spec. Protocol should any of ' + ' '.join(valid_protocol_specs)) - - if int(spec_parts[2]) > 65535: - raise ValueError('Invalid port spec.') + + spec_port = int(spec_parts[2]) + if spec_port > 65535 or spec_port < 1: + raise ValueError('Invalid port spec (greater/lower than allowed).') return tuple(spec_parts)