Fix (unreported) crash when file browser attempts to show preview of some defective font

Confirmed with the Wine's bundled fonts.
This commit is contained in:
Shinsuke Irie 2017-01-27 00:15:49 +09:00
parent 3c3c52a74b
commit f14e1da5aa
1 changed files with 4 additions and 0 deletions

View File

@ -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;