diff --git a/source/blender/editors/interface/regions/interface_region_tooltip.cc b/source/blender/editors/interface/regions/interface_region_tooltip.cc index 6e7274442a8..9fa88029f07 100644 --- a/source/blender/editors/interface/regions/interface_region_tooltip.cc +++ b/source/blender/editors/interface/regions/interface_region_tooltip.cc @@ -28,6 +28,7 @@ #include "DNA_userdef_types.h" +#include "BLI_fileops.h" #include "BLI_listbase.h" #include "BLI_math_color.h" #include "BLI_math_vector.h" @@ -1724,6 +1725,12 @@ static void ui_tooltip_from_vfont(VFont &font, uiTooltipData &data) return; } + if (!BLI_exists(font.filepath)) { + UI_tooltip_text_field_add( + &data, TIP_("File not found"), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_ALERT); + return; + } + float color[4]; const uiWidgetColors *theme = ui_tooltip_get_theme(); rgba_uchar_to_float(color, theme->text); diff --git a/source/blender/imbuf/intern/thumbs_font.cc b/source/blender/imbuf/intern/thumbs_font.cc index 827ebc8dc66..2ef5ce2f71c 100644 --- a/source/blender/imbuf/intern/thumbs_font.cc +++ b/source/blender/imbuf/intern/thumbs_font.cc @@ -49,6 +49,9 @@ bool IMB_thumb_load_font_get_hash(char *r_hash) ImBuf *IMB_font_preview(const char *filepath, uint width, const float color[4]) { int font_id = (filepath[0] != '<') ? BLF_load(filepath) : 0; + if (font_id == -1) { + return nullptr; + } const char sample[] = "ABCDEFGH\nabcdefg123"; BLF_buffer_col(font_id, color);