# HG changeset patch
# User Simon Farnsworth <simonfar@fb.com>
# Date 2016-02-10 09:48:58
# Node ID ff6e8dc659f860c9bdaf7d15cf7929009daa60a8
# Parent  92e8e3f20a6fbc641247153d0ea0f6300437b136

help: don't crash in keyword search if an extension fails to provide docs

Not all external extensions provide docs; if you use such an extension, you
will experience a crash if you use "hg help --keyword <word>", and <word>
happens to match the extension name.

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -149,6 +149,8 @@ def topicmatch(ui, kw):
     for name, docs in itertools.chain(
         extensions.enabled(False).iteritems(),
         extensions.disabled().iteritems()):
+        if not docs:
+            continue
         mod = extensions.load(ui, name, '')
         name = name.rpartition('.')[-1]
         if lowercontains(name) or lowercontains(docs):