diff options
author | Guido van Rossum <guido@python.org> | 1997-05-30 11:58:21 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-05-30 11:58:21 (GMT) |
commit | 72a342fd4f62238f5ff76201e6d34cd39b99de87 (patch) | |
tree | 2c0f8b693ae07898bdcb560f1cdf8c74da0de9ae /Tools | |
parent | 00494bfa15b4eb04ebc665b193d6f6d74e851805 (diff) | |
download | cpython-72a342fd4f62238f5ff76201e6d34cd39b99de87.zip cpython-72a342fd4f62238f5ff76201e6d34cd39b99de87.tar.gz cpython-72a342fd4f62238f5ff76201e6d34cd39b99de87.tar.bz2 |
Protect roulette against empty FAQ.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/faqwiz/faqwiz.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/faqwiz/faqwiz.py b/Tools/faqwiz/faqwiz.py index 7fe0118..e721425 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): |