Skip to content

Commit

Permalink
do not fail if no engine matches
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Feb 8, 2024
1 parent 7ae44de commit c51c4a8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pyprland/adapters/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ class BemenuMenu(MenuEngine):

async def init(force_engine=False, extra_parameters="") -> MenuEngine:
"initializes the module"
engines = (
[next(e for e in every_menu_engine if e.proc_name == force_engine)]
if force_engine
else every_menu_engine
)
try:
engines = (
[next(e for e in every_menu_engine if e.proc_name == force_engine)]
if force_engine
else every_menu_engine
)
except StopIteration:
engines = []

for engine in engines:
if engine.is_available():
return engine(extra_parameters)
Expand Down

0 comments on commit c51c4a8

Please sign in to comment.