From c82f5991b94fb60a2ce6e2cc58708ecdab03c662 Mon Sep 17 00:00:00 2001 From: Nils Date: Thu, 14 Jul 2022 23:49:50 +0200 Subject: [PATCH] Handle xdg-lib exceptions and log them as error, instead of crashing --- engine/findprograms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/findprograms.py b/engine/findprograms.py index 225f2a0..3456b8f 100644 --- a/engine/findprograms.py +++ b/engine/findprograms.py @@ -100,7 +100,11 @@ class SupportedProgramsDatabase(object): pass for f in basePath.glob('**/*'): if f.is_file() and f.suffix == ".desktop": - desktopEntry = xdg.DesktopEntry.DesktopEntry(f) + try: #the xdg lib will still raise errors when encountering a malformed .desktop file + desktopEntry = xdg.DesktopEntry.DesktopEntry(f) + except Exception as e: + logger.error(f"Desktop file {f} has problems: {e}") + continue """ #Don't validate. This is over-zealous and will mark deprecation and unknown categories.