diff --git a/src/glsl_glyphs/reader.py b/src/glsl_glyphs/reader.py index c578d2c..838be36 100644 --- a/src/glsl_glyphs/reader.py +++ b/src/glsl_glyphs/reader.py @@ -18,7 +18,9 @@ MAX_GLYPHS = 256 class Reader: def __init__(self, params: Parameters) -> None: - self.source_image_path = pathlib.Path(params.source_image_path) + self.source_image_path = ( + pathlib.Path(params.source_image_path) if params.source_image_path else None + ) self.source_names_path = ( pathlib.Path(params.source_names_path) if params.source_names_path else None ) @@ -60,6 +62,11 @@ class Reader: return self.__read_sentences(names) def __read_image(self) -> list[Glyph]: + if not self.source_image_path: + self.log.error( + "No input image provided" + ) + sys.exit(1) try: img = Image.open(self.source_image_path).convert("1") if img.width % 8 != 0 or img.height % 8 != 0: