From e9a4df5327505a4a8cdce66afe11d6885c0b08e9 Mon Sep 17 00:00:00 2001 From: John Wang Date: Thu, 18 May 2023 18:55:29 +0800 Subject: [PATCH] fix: npe when installed_app.app not found --- api/controllers/console/explore/wraps.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/controllers/console/explore/wraps.py b/api/controllers/console/explore/wraps.py index 21b7757a57..601e9352ea 100644 --- a/api/controllers/console/explore/wraps.py +++ b/api/controllers/console/explore/wraps.py @@ -27,7 +27,13 @@ def installed_app_required(view=None): ).first() if installed_app is None: - NotFound('Installed app not found') + raise NotFound('Installed app not found') + + if not installed_app.app: + db.session.delete(installed_app) + db.session.commit() + + raise NotFound('Installed app not found') return view(installed_app, *args, **kwargs) return decorated