From a9e69782562a54363f84463be645e7657505730a Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Mon, 2 Nov 2015 16:13:07 +0100
Subject: [PATCH] Fix crash listing zero batch jobs in admin

---
 mutalyzer/entrypoints/admin.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mutalyzer/entrypoints/admin.py b/mutalyzer/entrypoints/admin.py
index f9eeff88..d41df614 100644
--- a/mutalyzer/entrypoints/admin.py
+++ b/mutalyzer/entrypoints/admin.py
@@ -176,6 +176,9 @@ def list_batch_jobs():
         ).label('count')
     ).order_by(BatchJob.added.asc()).all()
 
+    if len(batch_jobs_with_counts) < 1:
+        return
+
     lengths = {
         'id_len': max(len(str(j.id)) for j, _ in batch_jobs_with_counts),
         'type_len': max(len(j.job_type) for j, _ in batch_jobs_with_counts),
-- 
GitLab