From: Guido van Rossum Date: Fri, 30 May 1997 11:58:21 +0000 (+0000) Subject: Protect roulette against empty FAQ. X-Git-Tag: v1.5a3~411 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72a342fd4f62238f5ff76201e6d34cd39b99de87;p=python Protect roulette against empty FAQ. --- diff --git a/Tools/faqwiz/faqwiz.py b/Tools/faqwiz/faqwiz.py index 7fe0118177..e721425190 100644 --- a/Tools/faqwiz/faqwiz.py +++ b/Tools/faqwiz/faqwiz.py @@ -328,6 +328,7 @@ class FaqDir: def roulette(self): self.__fill() import whrandom + if not self.__files: return None return whrandom.choice(self.__files) def list(self): @@ -576,8 +577,11 @@ class FaqWizard: emit(TAIL_RECENT) def do_roulette(self): - self.prologue(T_ROULETTE) file = self.dir.roulette() + if not file: + self.error("No entries.") + return + self.prologue(T_ROULETTE) self.dir.show(file) def do_help(self):