From e3779531fd86394916555c266df3f7beaca39a05 Mon Sep 17 00:00:00 2001 From: sMezaOrellana Date: Tue, 26 Nov 2024 13:24:50 +0100 Subject: [PATCH] Add exception handling --- dissect/target/helpers/compat/path_common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dissect/target/helpers/compat/path_common.py b/dissect/target/helpers/compat/path_common.py index eda3962a7..e40566deb 100644 --- a/dissect/target/helpers/compat/path_common.py +++ b/dissect/target/helpers/compat/path_common.py @@ -90,7 +90,12 @@ def close(self): def scandir(path: TargetPath) -> _DissectScandirIterator: - return _DissectScandirIterator(path.get().scandir()) + try: + sdir = path.get().scandir() + except Exception: + sdir = iter([]) + + return _DissectScandirIterator(sdir) def realpath(path: TargetPath, *, strict: bool = False) -> str: