aboutsummaryrefslogtreecommitdiff
path: root/modules/util.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2024-01-04 11:15:56 +0300
committerGitHub <noreply@github.com>2024-01-04 11:15:56 +0300
commit397251ba0cc1a1df2c558c28c416b64eef73a051 (patch)
treec5bd1c25eae4d890b7f5f79d938ca5e04802bafc /modules/util.py
parent149c9d223463c8fc34f53f26ca06e02be4c8835b (diff)
parentdf62ffbd2525792c115adefdbaeb7799699624b1 (diff)
Merge pull request #14527 from akx/avoid-isfiles
Avoid unnecessary `isfile`/`exists` calls
Diffstat (limited to 'modules/util.py')
-rw-r--r--modules/util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/util.py b/modules/util.py
index c2a27590..ee373e92 100644
--- a/modules/util.py
+++ b/modules/util.py
@@ -21,11 +21,11 @@ def html_path(filename):
def html(filename):
path = html_path(filename)
- if os.path.exists(path):
+ try:
with open(path, encoding="utf8") as file:
return file.read()
-
- return ""
+ except OSError:
+ return ""
def walk_files(path, allowed_extensions=None):