Skip to content

Commit b95c671

Browse files
committed
font-patcher: Fix behavior when trying to patch non-font files
[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 <[email protected]> Signed-off-by: Fini Jastrow <[email protected]>
1 parent f647334 commit b95c671

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

font-patcher

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import absolute_import, print_function, unicode_literals
77

88
# Change the script version when you edit this script:
9-
script_version = "4.14.3"
9+
script_version = "4.14.4"
1010

1111
version = "3.2.1"
1212
projectName = "Nerd Fonts"
@@ -2127,6 +2127,9 @@ def main():
21272127

21282128
sourceFonts = []
21292129
all_fonts = fontforge.fontsInFile(args.font)
2130+
if not all_fonts:
2131+
logger.critical("Can not find any fonts in '%s'", args.font)
2132+
sys.exit(1)
21302133
for i, subfont in enumerate(all_fonts):
21312134
if len(all_fonts) > 1:
21322135
print("\n")

0 commit comments

Comments
 (0)