Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

needextend: new link to not existing needs crashes #976

Closed
danwos opened this issue Aug 21, 2023 · 0 comments · Fixed by #1037
Closed

needextend: new link to not existing needs crashes #976

danwos opened this issue Aug 21, 2023 · 0 comments · Fixed by #1037

Comments

@danwos
Copy link
Member

danwos commented Aug 21, 2023

If I set an extra-link via needextend like this:

.. needextend:: NEED_1
   :own_link_type: NOT_EXISTING_NEED_ID

needextend.py throws an error:

  File "[...]/python3.8/site-packages/sphinx_needs/directives/need.py", line 393, in process_need_nodes
    process_needextend(app, doctree, fromdocname)
  File "[...]/python3.8/site-packages/sphinx_needs/directives/needextend.py", line 142, in process_needextend
    if found_need["id"] not in env.needs_all_needs[ref_need][f"{option_name}_back"]:
KeyError: 'NOT_EXISTING_NEED_ID'

The reason is that this code:
found_need["id"] not in env.needs_all_needs[ref_need][f"{option_name}_back"]
is using env.needs_all_needs[ref_need] and ref_need is referencing a not existing need.

Solution: Check if the link target exists in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant