Add safety check for db access that was not yet handled by db_request

This commit is contained in:
DominikDoom
2024-04-13 19:26:20 +02:00
parent d1eea880f3
commit 1b592dbf56

View File

@@ -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):