Skip to content

Commit e6f6b55

Browse files
author
Federico Bregant
committed
fix: correct order for valid port range
1 parent 9eeba4f commit e6f6b55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

can/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ def _create_bus_config(config: Dict[str, Any]) -> typechecking.BusConfig:
215215
if isinstance(config["port"], str):
216216
if config["port"].isnumeric():
217217
config["port"] = int(config["port"])
218-
if not 0 < config["port"] < 65535:
219-
raise ValueError("Port config must be inside 0-65535 range!")
220218
else:
221219
raise ValueError("Port config must be a number!")
222220
elif not isinstance(config["port"], int):
223221
raise TypeError("Port config must be string or integer!")
222+
if not 0 < config["port"] < 65535:
223+
raise ValueError("Port config must be inside 0-65535 range!")
224224
if "bitrate" in config:
225225
config["bitrate"] = int(config["bitrate"])
226226
if "fd" in config:

0 commit comments

Comments
 (0)