From 203340b3a10214d7747f64545dfcc89c4bc03eb2 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:58:15 +0300 Subject: [PATCH] If the selected font index is out of bounds, fall back to Roboto --- src/Autoload/Global.gd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 1d6e7ed22..314b0b012 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -223,8 +223,12 @@ var theme_font_index := 1: if theme_font_index < loaded_fonts.size(): theme_font = loaded_fonts[theme_font_index] else: - var font_name := get_available_font_names()[theme_font_index] - theme_font = find_font_from_name(font_name) + var available_font_names := get_available_font_names() + if theme_font_index < available_font_names.size(): + var font_name := available_font_names[theme_font_index] + theme_font = find_font_from_name(font_name) + else: + theme_font = loaded_fonts[1] # Fall back to Roboto if out of bounds ## Found in Preferences. The font size used by the interface. var font_size := 16 ## Found in Preferences. If [code]true[/code], the interface dims on popups.