summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Karamazov <deserter666@danwin1210.me>2021-04-06 22:48:51 +0530
committerDimitri Karamazov <deserter666@danwin1210.me>2021-04-06 22:48:51 +0530
commit221a3da53cb4b5d87d33810947be615f02670e35 (patch)
treeb25046cab711a96afc9f8de660dbd54bb5858d6f
parent4e7efe1ba67a5a749895ceea453d7df30f800037 (diff)
downloadqutebrowser-221a3da53cb4b5d87d33810947be615f02670e35.tar.gz
qutebrowser-221a3da53cb4b5d87d33810947be615f02670e35.zip
Improve error handling, remove list call
-rw-r--r--qutebrowser/misc/elf.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/qutebrowser/misc/elf.py b/qutebrowser/misc/elf.py
index ce256ee7f..aa92ff53f 100644
--- a/qutebrowser/misc/elf.py
+++ b/qutebrowser/misc/elf.py
@@ -316,13 +316,13 @@ def parse_webenginecore() -> Optional[Versions]:
else:
library_path = pathlib.Path(QLibraryInfo.location(QLibraryInfo.LibrariesPath))
- library_name = sorted(list(pathlib.Path(library_path).glob('libQt5WebEngineCore.so*')))
- lib_file = library_path / library_name[-1].as_posix()
- if lib_file.exists():
- log.misc.debug(f"QtWebEngine .so found at {lib_file}")
- else:
+ library_name = sorted(pathlib.Path(library_path).glob('libQt5WebEngineCore.so*'))
+ if not library_name:
log.misc.debug(f"No QtWebEngine .so found in {library_path}")
return None
+ else:
+ lib_file = library_path / library_name[-1]
+ log.misc.debug(f"QtWebEngine .so found at {lib_file}")
try:
with lib_file.open('rb') as f: