fix: npe when installed_app.app not found

This commit is contained in:
John Wang 2023-05-18 18:55:29 +08:00
parent 6ec916a2f3
commit e9a4df5327
1 changed files with 7 additions and 1 deletions

View File

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