Skip to content

Commit 4eb90f6

Browse files
Greg BrooksGregox273
authored andcommitted
Check state argument type before attempting conversion (#1956)
1 parent 3e7b065 commit 4eb90f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

can/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def _create_bus_config(config: dict[str, Any]) -> typechecking.BusConfig:
249249
if "fd" in config:
250250
config["fd"] = config["fd"] not in (0, False)
251251

252-
if "state" in config:
252+
if "state" in config and not isinstance(config["state"], can.BusState):
253253
try:
254254
config["state"] = can.BusState[config["state"]]
255255
except KeyError as e:

0 commit comments

Comments
 (0)