这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Finii
Copy link
Collaborator

@Finii Finii commented Jun 2, 2024

[why]
When the file specified to be patched is not a font file the patcher run errors out with an out of index runtime error:

Traceback (most recent call last):
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2155, in <module>
    main()
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2147, in main
    patcher.generate(sourceFonts)
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 415, in generate
    sourceFont = sourceFonts[0]
                 ~~~~~~~~~~~^^^
IndexError: list index out of range

[how]
Do not assume that the specified file will be a font file but rather check if fontforge detects a font in the file and error out if there is no font found.

Fixes: #1647

Reported-by: Kristopher James Kent kris@kjkent.dev

Requirements / Checklist

  • Read the Contributing Guidelines
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan.
    Issue number where discussion took place: #xxx
  • If this contains a font/glyph add its origin as background info below (e.g. URL)
  • Verified the license of any newly added font, glyph, or glyph set. License is: xxx

What does this Pull Request (PR) do?

Prevent a runtime error in certain situations and instead prints an understandable explanation why processing can not continue.

How should this be manually tested?

Any background context you can provide?

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

@Finii Finii added the Bug fix label Jun 2, 2024
@Finii
Copy link
Collaborator Author

Finii commented Jun 2, 2024

Screenshot from 2024-06-02 08-21-38

[why]
When the file specified to be patched is not a font file the patcher run
errors out with an out of index runtime error:

Traceback (most recent call last):
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2155, in <module>
    main()
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 2147, in main
    patcher.generate(sourceFonts)
  File "/home/fini/extra/git/nerd-fonts/font-patcher", line 415, in generate
    sourceFont = sourceFonts[0]
                 ~~~~~~~~~~~^^^
IndexError: list index out of range

[how]
Do not assume that the specified file will be a font file but rather
check if fontforge detects a font in the file and error out if there is
no font found.

Fixes: #1647

Reported-by: Kristopher James Kent <kris@kjkent.dev>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii force-pushed the bugfix/no-font-in-file branch from e7f6a4f to c8f68dc Compare June 2, 2024 06:48
@Finii Finii merged commit b95c671 into master Jun 2, 2024
@Finii Finii deleted the bugfix/no-font-in-file branch June 2, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker nerdfonts-patcher errors out on fontforge start

2 participants