[Bf-blender-cvs] [f14e1da5aa] master: Fix (unreported) crash when file browser attempts to show preview of some defective font

IRIE Shinsuke noreply at git.blender.org
Thu Jan 26 16:36:30 CET 2017


Commit: f14e1da5aae4ef6de0f8ad5ae5b393bc9d19a726
Author: IRIE Shinsuke
Date:   Fri Jan 27 00:15:49 2017 +0900
Branches: master
https://developer.blender.org/rBf14e1da5aae4ef6de0f8ad5ae5b393bc9d19a726

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

Confirmed with the Wine's bundled fonts.

===================================================================

M	source/blender/blenfont/intern/blf_thumbs.c

===================================================================

diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c
index 133168fccf..b6f5ffbb09 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;




More information about the Bf-blender-cvs mailing list