From 1b592dbf56eca9117cadcb234fc7299c35792a89 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Sat, 13 Apr 2024 19:26:20 +0200 Subject: [PATCH] Add safety check for db access that was not yet handled by db_request --- scripts/tag_autocomplete_helper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index 0a2c479..d61150e 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -802,7 +802,10 @@ def api_tac(_: gr.Blocks, app: FastAPI): date_limit = getattr(shared.opts, "tac_frequencyMaxAge", 30) date_limit = date_limit if date_limit > 0 else None - count_list = list(db.get_tag_counts(body.tagNames, body.tagTypes, body.neg, date_limit)) + if db: + count_list = list(db.get_tag_counts(body.tagNames, body.tagTypes, body.neg, date_limit)) + else: + count_list = None # If a limit is set, return at max the top n results by count if count_list and len(count_list):