From 2c83845dacbe56ded0ed0f0201c06e904dade587 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 12 Jun 2022 11:10:06 +0200 Subject: [PATCH] Preview section - add helpful check --- changedetectionio/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 123d16dd..9bba1c8a 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -855,6 +855,12 @@ def changedetection_app(config=None, datastore_o=None): if uuid == 'first': uuid = list(datastore.data['watching'].keys()).pop() + # Normally you would never reach this, because the 'preview' button is not available when there's no history + # However they may try to scrub and reload the page + if datastore.data['watching'][uuid].history_n == 0: + flash("Preview unavailable - No fetch/check completed or triggers not reached", "error") + return redirect(url_for('index')) + extra_stylesheets = [url_for('static_content', group='styles', filename='diff.css')] try: