Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias C. M. Troffaes <matthias.troffaes@gmail.com>2021-02-16 12:24:10 +0300
committerGitHub <noreply@github.com>2021-02-16 12:24:10 +0300
commit57ae92ce78cc337be78d27b0309cdaed33d39fde (patch)
tree966774e7fb5666e3394673500b149d58e9cc5173 /sphinx/transforms
parent633c5ad9c6f4511e3016dd451f17ace1ad160fb2 (diff)
fix potential getitem error in resolve_anyref
Diffstat (limited to 'sphinx/transforms')
-rw-r--r--sphinx/transforms/post_transforms/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/transforms/post_transforms/__init__.py b/sphinx/transforms/post_transforms/__init__.py
index 1c424050a..f8b01e81f 100644
--- a/sphinx/transforms/post_transforms/__init__.py
+++ b/sphinx/transforms/post_transforms/__init__.py
@@ -125,7 +125,7 @@ class ReferencesResolver(SphinxPostTransform):
for role in domain.roles:
res = domain.resolve_xref(self.env, refdoc, self.app.builder,
role, target, node, contnode)
- if res and isinstance(res[0], nodes.Element):
+ if res and len(res) > 0 and isinstance(res[0], nodes.Element):
results.append(('%s:%s' % (domain.name, role), res))
# now, see how many matches we got...
if not results: