From 9107d75216f2fb3ba851ca37c48f154691ad8431 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Fri, 4 Sep 2020 21:18:55 +0200 Subject: [PATCH] Fix crash --- pynyaata/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pynyaata/__init__.py b/pynyaata/__init__.py index d187fb3..04438d5 100644 --- a/pynyaata/__init__.py +++ b/pynyaata/__init__.py @@ -108,13 +108,13 @@ def list_animes(url_filters='nyaa,yggtorrent'): def remove_garbage(link): title = link.title - folder = title.folder - if not len(title.links): - db.session.delete(title) - db.session.commit() - if not len(folder.titles): - db.session.delete(folder) - db.session.commit() + if title: + if not len(title.links): + db.session.delete(title) + db.session.commit() + if not len(title.folder.titles): + db.session.delete(title.folder) + db.session.commit() @app.route('/admin', methods=['GET', 'POST'])