From 70ee7f44c7e0f80047c7aa843b8c63aa945540a9 Mon Sep 17 00:00:00 2001
From: Julian Rother <julianr@fsmpi.rwth-aachen.de>
Date: Sun, 16 Oct 2016 18:10:42 +0200
Subject: [PATCH] Return 404 when no chapters are found (#161)

---
 server.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server.py b/server.py
index 71289fb..3d6a540 100644
--- a/server.py
+++ b/server.py
@@ -579,6 +579,8 @@ def suggest_chapter(lectureid):
 @app.route('/chapters/<int:lectureid>')
 def chapters(lectureid):
 	chapters = query("SELECT * FROM chapters WHERE lecture_id = ? and visible ORDER BY time DESC", lectureid)
+	if not chapters:
+		return 'No chapters found', 404
 	last = None
 	for c in chapters:
 		c['start'] = c['time']
-- 
GitLab