diff --git a/sphinx/environment.py b/sphinx/environment.py index 52d5ff082..171fe3241 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -1747,7 +1747,7 @@ class BuildEnvironment: continue figtype = get_figtype(subnode) - if figtype: + if figtype and subnode['ids']: register_fignumber(docname, secnum, figtype, subnode['ids'][0])