Skip to content

Commit

Permalink
fix: avoid crash if shortcut template is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Feb 28, 2024
1 parent 0f7a0e2 commit c8cb926
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions qgis_deployment_toolbelt/shortcuts/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,20 @@ def freedesktop_create(self) -> tuple[Path | None, Path | None]:
f"Using shortcut template in packaged mode: {template_shortcut}"
)

check_path(
if not check_path(
input_path=template_shortcut,
must_be_a_file=True,
must_be_readable=True,
must_exists=True,
)
raise_error=False,
):
logger.error(
FileNotFoundError(
f"Shortcut template ({template_shortcut}) doesn't exist. "
"Unable to create shortcuts."
)
)
return (None, None)

# load template
with template_shortcut.open("r", encoding="UTF-8") as bf_tpl:
Expand Down

0 comments on commit c8cb926

Please sign in to comment.