From f14e1da5aae4ef6de0f8ad5ae5b393bc9d19a726 Mon Sep 17 00:00:00 2001 From: IRIE Shinsuke Date: Fri, 27 Jan 2017 00:15:49 +0900 Subject: Fix (unreported) crash when file browser attempts to show preview of some defective font Confirmed with the Wine's bundled fonts. --- source/blender/blenfont/intern/blf_thumbs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenfont') diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c index 133168fccf2..b6f5ffbb092 100644 --- a/source/blender/blenfont/intern/blf_thumbs.c +++ b/source/blender/blenfont/intern/blf_thumbs.c @@ -98,6 +98,10 @@ void BLF_thumb_preview( blf_font_size(font, (unsigned int)MAX2(font_size_min, font_size_curr), dpi); + /* font->glyph_cache remains NULL if blf_font_size() failed to set font size */ + if (!font->glyph_cache) + break; + /* decrease font size each time */ font_size_curr -= (font_size_curr / font_shrink); font_shrink += 1; -- cgit v1.2.3