mirror of https://gitlab.com/litecord/litecord.git
embed.sanitizer: use try/except instead of key membership check
This commit is contained in:
parent
ff9d421a3c
commit
b6da5ad9d3
|
|
@ -70,10 +70,10 @@ def path_exists(embed: Embed, components_in: Union[List[str], str]):
|
||||||
|
|
||||||
# if it exists, then we go down a level inside the dict
|
# if it exists, then we go down a level inside the dict
|
||||||
# (via recursion)
|
# (via recursion)
|
||||||
if current in embed:
|
try:
|
||||||
return path_exists(embed[current], components[1:])
|
return path_exists(embed[current], components[1:])
|
||||||
|
except KeyError:
|
||||||
# if it doesn't exist, return False
|
# if the current component doesn't exist, return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue