From 058565993c00cce533c834bf14ab1ac1f0793d0e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 5 Feb 2013 09:09:50 -0500 Subject: [PATCH] Don't crash with IndexError when we run out of questions --- quizzer/ui/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quizzer/ui/__init__.py b/quizzer/ui/__init__.py index eb8682d..43c1502 100644 --- a/quizzer/ui/__init__.py +++ b/quizzer/ui/__init__.py @@ -11,7 +11,8 @@ class UserInterface (object): def get_question(self): remaining = [q for q in self.quiz if q not in self.answers] - return remaining[0] + if remaining: + return remaining[0] def process_answer(self, question, answer): if question not in self.answers: -- 2.26.2