Skip to content

Commit

Permalink
Early exit if no monospace fonts were found
Browse files Browse the repository at this point in the history
 This also provides a helpful log error message and avoids triggering a
 later panic as reported in #323.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
  • Loading branch information
MoSal authored and jackpot51 committed Sep 3, 2024
1 parent 3eec597 commit 3f10b72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3f10b72

Please sign in to comment.