From d7c83f58b9c66864a99fe55862592765e8e26d96 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 25 Jul 2021 17:01:21 +0100 Subject: [PATCH] Fix crash on profile with no pacakges --- app/blueprints/users/profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/blueprints/users/profile.py b/app/blueprints/users/profile.py index 71316d2d..67c90bb8 100644 --- a/app/blueprints/users/profile.py +++ b/app/blueprints/users/profile.py @@ -70,7 +70,7 @@ def profile(username): total_downloads = db.session.query(func.sum(Package.downloads)) \ .select_from(User) \ .join(User.maintained_packages) \ - .filter(User.id == user.id, Package.state == PackageState.APPROVED).scalar() + .filter(User.id == user.id, Package.state == PackageState.APPROVED).scalar() or 0 # Process GET or invalid POST return render_template("users/profile.html", user=user, packages=packages,