From 3f10b729dd25f37efa876a80baf7253b6d49d932 Mon Sep 17 00:00:00 2001 From: Mohammad AlSaleh Date: Tue, 3 Sep 2024 01:11:17 +0300 Subject: [PATCH] Early exit if no monospace fonts were found This also provides a helpful log error message and avoids triggering a later panic as reported in #323. Signed-off-by: Mohammad AlSaleh --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 5e834a0..0b8f5cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1415,6 +1415,13 @@ impl Application for App { }); font_name_faces_map }; + + if font_name_faces_map.is_empty() { + log::error!("at least one monospace font with normal/bold weights and default stretch is required"); + log::error!("no monospace fonts to select from, exiting"); + process::exit(1); + } + let font_names = font_name_faces_map.keys().cloned().collect(); let mut font_size_names = Vec::new();