From: W. Trevor King Date: Tue, 5 Feb 2013 14:09:50 +0000 (-0500) Subject: Don't crash with IndexError when we run out of questions X-Git-Tag: v0.1~75 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=058565993c00cce533c834bf14ab1ac1f0793d0e;p=quizzer.git Don't crash with IndexError when we run out of questions --- 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: